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