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