public async Task <IActionResult> Edit(int id, [Bind("RefTeacherPositionId,TeacherPositionCode,TeacherPosition")] RefTeacherPosition refTeacherPosition) { if (id != refTeacherPosition.RefTeacherPositionId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(refTeacherPosition); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RefTeacherPositionExists(refTeacherPosition.RefTeacherPositionId)) { return(NotFound()); } else { throw; } } TempData["messageType"] = "success"; TempData["messageTitle"] = "RECORD UPDATED"; TempData["message"] = "Record successfully updated"; return(RedirectToAction(nameof(Index))); } return(View(refTeacherPosition)); }
public async Task <IActionResult> Create([Bind("RefTeacherPositionId,TeacherPositionCode,TeacherPosition")] RefTeacherPosition refTeacherPosition) { if (ModelState.IsValid) { _context.Add(refTeacherPosition); await _context.SaveChangesAsync(); TempData["messageType"] = "success"; TempData["messageTitle"] = "RECORD CREATED"; TempData["message"] = "New record successfully created"; return(RedirectToAction(nameof(Index))); } return(View(refTeacherPosition)); }