public IActionResult Edit(int id, PartEditModel part) { if (!this.ModelState.IsValid) { return(this.View(new PartSingleModel { Id = id, Name = part.Name, Price = part.Price })); } this.partService.Edit(id, part.Name, part.Price); return(this.RedirectToAction(nameof(Index))); }
public IActionResult Edit(int id, PartEditModel part) { if (!this.ModelState.IsValid) { return(this.NotFound()); } this.partService.EditPart(id, part.Price, part.Quantity); return(this.RedirectToAction(nameof(this.All))); }
public IActionResult Edit(PartEditModel model) { this.parts.Edit(model.Id, model.Price, model.Quantity); return(RedirectToAction(nameof(All))); }