AjaxResponse.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. namespace Abp.Web.Models
  3. {
  4. /// <summary>
  5. /// This class is used to create standard responses for AJAX/remote requests.
  6. /// </summary>
  7. [Serializable]
  8. public class AjaxResponse : AjaxResponse<object>
  9. {
  10. /// <summary>
  11. /// Creates an <see cref="AjaxResponse"/> object.
  12. /// <see cref="AjaxResponseBase.Success"/> is set as true.
  13. /// </summary>
  14. public AjaxResponse()
  15. {
  16. }
  17. /// <summary>
  18. /// Creates an <see cref="AjaxResponse"/> object with <see cref="AjaxResponseBase.Success"/> specified.
  19. /// </summary>
  20. /// <param name="success">Indicates success status of the result</param>
  21. public AjaxResponse(bool success)
  22. : base(success)
  23. {
  24. }
  25. /// <summary>
  26. /// Creates an <see cref="AjaxResponse"/> object with <see cref="AjaxResponse{TResult}.Result"/> specified.
  27. /// <see cref="AjaxResponseBase.Success"/> is set as true.
  28. /// </summary>
  29. /// <param name="result">The actual result object</param>
  30. public AjaxResponse(object result)
  31. : base(result)
  32. {
  33. }
  34. /// <summary>
  35. /// Creates an <see cref="AjaxResponse"/> object with <see cref="AjaxResponseBase.Error"/> specified.
  36. /// <see cref="AjaxResponseBase.Success"/> is set as false.
  37. /// </summary>
  38. /// <param name="error">Error details</param>
  39. /// <param name="unAuthorizedRequest">Used to indicate that the current user has no privilege to perform this request</param>
  40. public AjaxResponse(ErrorInfo error, bool unAuthorizedRequest = false)
  41. : base(error, unAuthorizedRequest)
  42. {
  43. }
  44. }
  45. }