public void ProcessRequest(HttpContext context) { var basketId = context.Request.RawUrl.Split('/').Last(); var basket = BasketStore.Fetch(basketId); var seralizer = new JavaScriptSerializer(); var responseBody = seralizer.Serialize(basket); context.Response.StatusCode = (int)HttpStatusCode.OK; context.Response.Write(responseBody); }
public void ProcessRequest(HttpContext context) { var items = GetRequestBody(context); var basket = new Basket(items) { Price = Checkout(items) }; var basketId = BasketStore.Add(basket); context.Response.StatusCode = (int)HttpStatusCode.Created; context.Response.RedirectLocation = ("http://checkout-kata-api.local/baskets/" + basketId); }