public IActionResult Order(ProductOrderBindingModel productOrderBindingModel) { Product productToOrder = this.productService.GetByName(productOrderBindingModel.Product); this.orderService.AddProductToCurrentActiveOrder(productToOrder.Id, this.User.Id); return(this.Redirect("/")); }
public IActionResult Order(ProductOrderBindingModel input) { string productId = productService.GetId(input.Name); orderService.AddProductToActiveOrder(productId, User.Id); return(this.Redirect("/")); }
public IActionResult Order(ProductOrderBindingModel productOrderBindingModel) { Product productToOrder = this.productService.GetByName(productOrderBindingModel.Product); if (productToOrder == null) { this.ModelState.Add("Product", "Invalid product name."); return(this.Redirect("/")); } this.orderService.AddProductToCurrentActiveOrder(productToOrder.Id, this.User.Id); return(this.Redirect("/")); }