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.

51 lines
1.2 KiB

4 years ago
3 years ago
4 years ago
  1. using Apewer.Web;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. namespace Apewer.AspNetBridge
  6. {
  7. /// <summary></summary>
  8. public interface IHttpActionResult { }
  9. /// <summary></summary>
  10. public class HttpActionResult : IHttpActionResult
  11. {
  12. /// <summary></summary>
  13. public int Status { get; set; }
  14. /// <summary></summary>
  15. public string ContentType { get; set; }
  16. /// <summary></summary>
  17. public string Attachment { get; set; }
  18. /// <summary></summary>
  19. public byte[] Bytes { get; set; }
  20. /// <summary></summary>
  21. public StringPairs Cookies { get; set; }
  22. /// <summary></summary>
  23. public HttpActionResult()
  24. {
  25. Cookies = new StringPairs();
  26. }
  27. internal ApiModel ToModel()
  28. {
  29. var har = this;
  30. if (har == null) return new ApiStatusModel(204);
  31. var model = new ApiBytesModel();
  32. model.Status = har.Status;
  33. model.Bytes = har.Bytes;
  34. model.ContentType = har.ContentType;
  35. model.Attachment = har.Attachment;
  36. return model;
  37. }
  38. }
  39. }