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