public ActionResult CreateAgency() { var agencyVM = new AgencyVM(); agencyVM.AgencyTypeList = _commonService.GetAgencyTypes(); return(View(agencyVM)); }
public bool UpdateAgency(AgencyVM model) { if (model.AgencyId != 0) { var agency = _context.Agencies.Single(p => p.AgencyId == model.AgencyId); agency.Name = model.Name; agency.Number = model.Number; agency.AgencyTypeId = model.AgencyTypeId; _context.SaveChanges(); return(true); } return(false); }
public bool SaveAgency(AgencyVM model) { var agency = new Agency() { AgencyTypeId = model.AgencyTypeId, Name = model.Name, Number = model.Number }; _context.Agencies.Add(agency); _context.SaveChanges(); return(true); }
public ActionResult SaveAgency(AgencyVM model) { if (ModelState.IsValid) { bool result = _adminService.SaveAgency(model); if (result) { TempData["SuccessMessage"] = "Agency saved successfully."; return(RedirectToAction("Agency")); } } TempData["ErrorMessage"] = "Agency not saved."; return(RedirectToAction("CreateAgency")); }
public bool UpdateAgency(AgencyVM model) { return(_adminRepository.UpdateAgency(model)); }
public bool SaveAgency(AgencyVM model) { return(_adminRepository.SaveAgency(model)); }