public async Task <IActionResult> Edit(int id, [Bind("Id,NameKyrg,NameRus,CreateDate,DictStatusId,DeactiveDate")] DictAgencyPerm dictAgencyPerm) { if (id != dictAgencyPerm.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(dictAgencyPerm); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DictAgencyPermExists(dictAgencyPerm.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DictStatusId"] = new SelectList(_context.DictStatus, "Id", "Name", dictAgencyPerm.DictStatusId); return(View(dictAgencyPerm)); }
// GET: GlobalDicts/DictAgencyPerms/Create public IActionResult Create() { ViewData["DictStatusId"] = new SelectList(_context.DictStatus, "Id", "Name"); DictAgencyPerm model = new DictAgencyPerm(); model.CreateDate = DateTime.Now; return(View(model)); }
public async Task <IActionResult> Create([Bind("Id,NameKyrg,NameRus,CreateDate,DictStatusId,DeactiveDate")] DictAgencyPerm dictAgencyPerm) { if (ModelState.IsValid) { _context.Add(dictAgencyPerm); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DictStatusId"] = new SelectList(_context.DictStatus, "Id", "Name", dictAgencyPerm.DictStatusId); return(View(dictAgencyPerm)); }