public ActionResult Create(Product product) { if (ModelState.IsValid) { return(View(product)); } else { context.Insert(product); context.Commit(); return(RedirectToAction("Index")); } }
public ActionResult Create(ProductandCatagoryViewModel paramProduct) { if (!ModelState.IsValid) { return(View(paramProduct)); } else { MyProdRep.Insert(paramProduct.Product); MyProdRep.Commit(); return(RedirectToAction("Index")); } }
public ActionResult Create(ProductCategory category) { if (!ModelState.IsValid) { return(View(category)); } else { context.Insert(category); context.Commit(); return(RedirectToAction("Index")); } }
public ActionResult Create(ModelProduct product) { if (!ModelState.IsValid) { return(View(product)); } else { cRepositoryProducts.Insert(product); cRepositoryProducts.Commit(); return(RedirectToAction("Index")); } }
public ActionResult Create(ProductCategory productCategory) // method to have productCategory details posted in { if (!ModelState.IsValid) // ModelState relates to any validation rules we have set { return(View(productCategory)); } else { context.Insert(productCategory); context.Commit(); return(RedirectToAction("Index")); // Commit has happened so redirect to Index page } }
public ActionResult Create(ModelProductCategory cItem) { if (!ModelState.IsValid) { return(View(cItem)); } else { cRepository.Insert(cItem); cRepository.Commit(); return(RedirectToAction("Index")); } }
public ActionResult Create(ProductCategory product) { if (!ModelState.IsValid) { return(View(product)); } else { context.Insert(product); context.Commit(); return(RedirectToHome); } }
public ActionResult Create(ProductManagerViewModel productModel) { if (!ModelState.IsValid) { productModel.ProductCategories = productCategories.Collection(); return(View(productModel)); } else { context.Insert(productModel.Product); context.Commit(); return(RedirectToAction("Index")); } }
public ActionResult Create(Product product) { if (!ModelState.IsValid) { return(View(product)); } else { Console.WriteLine("Its in!"); context.Insert(product); context.Commit(); return(RedirectToAction("index")); } }
public ActionResult Create(ProductCategory productCategory) { if (!ModelState.IsValid) { Console.WriteLine("Not Valid"); return(View(productCategory)); } else { Console.WriteLine("The product category is: {0}.", productCategory); context.Insert(productCategory); context.Commit(); return(RedirectToAction("Index")); } }
public async Task <Unit> Handle(CoffeeRemoveCommand request, CancellationToken cancellationToken) { var item = await _repository.Find(request.Id); if (item == null) { throw new Exception($"Failed to remove item with {request.Id}"); } _repository.Remove(request.Id); _repository.Commit(); return(Unit.Value); }
public async Task <Unit> Handle(CoffeeCreateCommand request, CancellationToken cancellationToken) { var item = new CoffeeModel { Currency = request.Currency, Name = request.Name, Description = request.Description, Price = request.Price, ImageUrl = request.ImageUrl }; await _repository.Add(item); _repository.Commit(); return(Unit.Value); }
public ActionResult Edit(ProductCategory c) { if (!ModelState.IsValid) { return(View(c)); } else { ProductCategory categoryEdit = contextCategory.Find(c.Id); if (categoryEdit != null) { categoryEdit.Category = c.Category; contextCategory.Commit(); return(RedirectToAction("Index")); } else { return(HttpNotFound()); } } }