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