Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("DetailItemId,DetailTitle,DetailType,DetailGroupId")] DetailItem detailItem)
        {
            if (id != detailItem.DetailItemId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await _detailItemService.Edit(detailItem);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!await _detailItemService.DetailItemExistence(detailItem.DetailItemId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DetailGroupId"] = new SelectList(await _detailGroupService.GetAll(), "DetailGroupId", "Name", detailItem.DetailGroupId);
            return(View(detailItem));
        }
Ejemplo n.º 2
0
 public ActionResult Edit(DetailItem DetailItems)
 {
     if (ModelState.IsValid)
     {
         _detailItemService.Edit(DetailItems);
         return(RedirectToAction("Index/" + DetailItems.DetailGroupId));
     }
     ViewBag.DetailGroupId = new SelectList(_detailGroupService.DetailGroup(), "DetailGroupId", "Name", DetailItems.DetailGroupId);
     return(View(DetailItems));
 }