コード例 #1
0
        public bool SaveAgencyType(AgencyTypeVM model)
        {
            var agencyType = new AgencyType()
            {
                Description = model.Description
            };

            _context.AgencyTypes.Add(agencyType);
            _context.SaveChanges();
            return(true);
        }
コード例 #2
0
 public bool UpdateAgencyType(AgencyTypeVM model)
 {
     if (model.AgencyTypeId != 0)
     {
         var agencyType = _context.AgencyTypes.Single(p => p.AgencyTypeId == model.AgencyTypeId);
         agencyType.Description = model.Description;
         _context.SaveChanges();
         return(true);
     }
     return(false);
 }
コード例 #3
0
 public ActionResult UpdateAgencyType(AgencyTypeVM model)
 {
     if (ModelState.IsValid)
     {
         bool result = _adminService.UpdateAgencyType(model);
         if (result)
         {
             TempData["SuccessMessage"] = "Agency Type updated successfully.";
             return(RedirectToAction("AgencyType"));
         }
     }
     TempData["ErrorMessage"] = "Agency Type not updated.";
     return(RedirectToAction("EditAgencyType"));
 }
コード例 #4
0
 public bool UpdateAgencyType(AgencyTypeVM model)
 {
     return(_adminRepository.UpdateAgencyType(model));
 }
コード例 #5
0
 public bool SaveAgencyType(AgencyTypeVM model)
 {
     return(_adminRepository.SaveAgencyType(model));
 }