public virtual string CreateResponse(Customer customer, ResponseKind responseKind) { if (responseKind == ResponseKind.HTML) return new HtmlSerializer().SerializeToHtml(customer); return new XmlSerializer().SerializeToXml(customer); }
public Response <T> SetStatus(ResponseKind status, string errorMessage = null, IEnumerable <ErrorMessage> errors = null) { ErrorKind = status; ErrorMessage = errorMessage; Errors = errors; return(this); }
public Response <T> SetError(string errorMessage, ResponseKind errorKind, IEnumerable <ErrorMessage> errors = null) { ErrorMessage = errorMessage; ErrorKind = errorKind; Errors = errors; return(this); }
public bool Equals(ResponseKind other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Equals(other.kind, kind); }
private ObjectResult BuildError(object data, ResponseKind statusCode) { if (statusCode == ResponseKind.InternalServerError) { Console.Write($"[ERROR] {_path} ({{@data}})", data); } return(new ObjectResult(data) { StatusCode = (int)statusCode }); }
public void Deconstruct(out ResponseKind kind, out object arg) { kind = this.kind; arg = this.arg; }
public Response(ResponseKind kind, object arg) { this.kind = kind; this.arg = arg; }
internal static HttpResponseMessage GetResponse(HttpStatusCode statusCode, ResponseKind resKind, LroHeaders headers) { HttpResponseMessage res = GetResponse(statusCode, resKind); //res = AddHeaders(res, headers); return(res); }
internal static HttpResponseMessage GetResponse(HttpStatusCode statusCode, ResponseKind resKind) { HttpResponseMessage res = new HttpResponseMessage(); switch (resKind) { case ResponseKind.Initial: res.Content = new StringContent(InitialResponse); break; case ResponseKind.IntrimPolling: res.Content = new StringContent(IntrimPollingResponse_1); break; case ResponseKind.PostPolling: res.Content = new StringContent(LH_FinalResource); break; } return(res); }