public async Task <IActionResult> Edit(int id, [Bind("idLoaiUser,TenLoai")] LoaiUserModel loaiUserModel) { if (id != loaiUserModel.idLoaiUser) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(loaiUserModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LoaiUserModelExists(loaiUserModel.idLoaiUser)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(loaiUserModel)); }
public async Task <IActionResult> Create([Bind("idLoaiUser,TenLoai")] LoaiUserModel loaiUserModel) { if (ModelState.IsValid) { _context.Add(loaiUserModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(loaiUserModel)); }