public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Descrition")] Role role) { if (id != role.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(role); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RoleExists(role.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(role)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Surname,Mail,Password,KeyWord,ExpiredDate,IsTemporary,Image,Avatar,Image2,Description,RoleId")] UserExt ue) { User user = ue.GetUser(); if (id != user.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(user); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(user.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["RoleId"] = new SelectList(_context.Roles, "Id", "Name", user.RoleId); return(View(user)); }