public FindCartResponse Find(int id) { try { var response = new FindCartResponse(); var bc = new CartBusiness(); response.Result = bc.Find(id); return(response); } catch (Exception ex) { var httpError = new HttpResponseMessage() { StatusCode = (HttpStatusCode)422, ReasonPhrase = ex.Message }; throw new HttpResponseException(httpError); } }
public FindCartResponse FindByCookie() { try { var cookie = Request.Headers.GetCookies("cart")[0]; var response = new FindCartResponse(); var bc = new CartBusiness(); response.Result = bc.FindByCookie(cookie["cart"].Value); return(response); } catch (Exception ex) { var httpError = new HttpResponseMessage() { StatusCode = (HttpStatusCode)422, ReasonPhrase = ex.Message }; throw new HttpResponseException(httpError); } }