public async Task <IActionResult> Edit(int id, [Bind("Id,DeptId,QuestionNo,Point,Comment,DateTime")] Rating rating) { if (id != rating.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(rating); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RatingExists(rating.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(rating)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Name,PassCode")] Department department) { if (id != department.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(department); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DepartmentExists(department.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(department)); }