public int PlaceOrder() { System.Web.Mvc.FormCollection collection = new System.Web.Mvc.FormCollection(); Task <string> content = this.Request.Content.ReadAsStringAsync(); int body = JsonConvert.DeserializeObject <int>(content.Result); collection.Add(FormDataKeys.DeliveryAddress.ToString(), body.ToString()); CreateOrderResponse createOrderResponse = this.checkoutController.CreateOrderResponse(collection); return(createOrderResponse.Order.Id); }
public bool Register() { System.Web.Mvc.FormCollection collection = new System.Web.Mvc.FormCollection(); Task <string> content = this.Request.Content.ReadAsStringAsync(); AccountRegister body = JsonConvert.DeserializeObject <AccountRegister>(content.Result); collection.Add(FormDataKeys.Password.ToString(), body.Password); collection.Add(FormDataKeys.Email.ToString(), body.Email); collection.Add(FormDataKeys.FirstName.ToString(), body.FirstName); collection.Add(FormDataKeys.SecondName.ToString(), body.SecondName); System.Web.Mvc.ActionResult viewResult = (System.Web.Mvc.ActionResult)accountRegisterController.Register(collection); if (viewResult is System.Web.Mvc.ViewResult) { return(false);// same page User already exists } else if (viewResult is System.Web.Mvc.RedirectToRouteResult) { return(true);//direct to next page new user } return(false); }