public IActionResult Add3DPen(ThreeDPenBindingModel threeDPenModel) { if (!ModelState.IsValid) { return(View(threeDPenModel)); } this.threeDPens.Create( threeDPenModel.Make, threeDPenModel.Price, threeDPenModel.Description, threeDPenModel.ImageUrl, this.userManager.GetUserId(User)); return(RedirectToAction("All3DPens")); }
public IActionResult Edit3DPen(int id, ThreeDPenBindingModel threeDPenModel) { if (!ModelState.IsValid) { return(View(threeDPenModel)); } var threeDPenExists = this.threeDPens.Exists(id); if (!threeDPenExists) { return(NotFound()); } this.threeDPens.EditPen( id, threeDPenModel.Make, threeDPenModel.Price, threeDPenModel.Description, threeDPenModel.ImageUrl); return(RedirectToAction("All3DPens")); }