Advertisement
patryk_szwed

WcfService1 Service1

Jun 3rd, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.Serialization;
  5. using System.ServiceModel;
  6. using System.ServiceModel.Web;
  7. using System.Text;
  8.  
  9. namespace WcfService1
  10. {
  11. // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
  12. // NOTE: In order to launch WCF Test Client for testing this service, please select Service1.svc or Service1.svc.cs at the Solution Explorer and start debugging.
  13. public class Service1 : IService1
  14. {
  15.  
  16. public int Factorial(int value)
  17. {
  18. int fact = value;
  19. for (int i = value - 1; i >= 1; i--)
  20. {
  21. fact = fact * i;
  22. }
  23. return fact;
  24. }
  25.  
  26. public string GetData(int value)
  27. {
  28. return string.Format("You entered: {0}", value);
  29. }
  30.  
  31. public CompositeType GetDataUsingDataContract(CompositeType composite)
  32. {
  33. if (composite == null)
  34. {
  35. throw new ArgumentNullException("composite");
  36. }
  37. if (composite.BoolValue)
  38. {
  39. composite.StringValue += "Suffix";
  40. }
  41. return composite;
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement