コード例 #1
0
        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)));
        }
コード例 #2
0
        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)));
        }
コード例 #3
0
        public IActionResult Edit(PartEditModel model)
        {
            this.parts.Edit(model.Id, model.Price, model.Quantity);

            return(RedirectToAction(nameof(All)));
        }