You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ValuesController.cs 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System.Collections.Generic;
  2. using System.Web.Http;
  3. using iiie.Logs.DataAccess;
  4. using iiie.Logs.DBO;
  5. namespace Logs_test.Controllers
  6. {
  7. public class ValuesController : ApiController
  8. {
  9. // GET api/values
  10. public IEnumerable<string> Get()
  11. {
  12. return new string[] { "value1", "value2" };
  13. }
  14. // GET api/values/5
  15. public string Get(int id)
  16. {
  17. Logger.Error<int>(ResultStatus.DBError, "my private data", "my public data");
  18. Logger.Error<int>(ResultStatus.DBError, "my private/public data", "");
  19. Logger.Error<int>(ResultStatus.DBError, "my private data");
  20. var value = "value";
  21. if (OpResult<int>.Ok(42))
  22. value += " ok";
  23. if (!OpResult<int>.Error(ResultStatus.InputError, "", ""))
  24. value += " error";
  25. return value;
  26. }
  27. public OpResult<int> Test()
  28. {
  29. var res = OpResult<bool>.Error(ResultStatus.DBError, "Test");
  30. return res.To<int>();
  31. }
  32. // POST api/values
  33. public void Post([FromBody]string value)
  34. {
  35. }
  36. // PUT api/values/5
  37. public void Put(int id, [FromBody]string value)
  38. {
  39. }
  40. // DELETE api/values/5
  41. public void Delete(int id)
  42. {
  43. }
  44. }
  45. }