Exemple #1
0
        public ActionResult Delete(int?serviceTypePK)
        {
            IServiceTypesRepository serviceTypesRepository = new ServiceTypesRepository(db);

            if (serviceTypePK != null)
            {
                ServiceType serviceType = serviceTypesRepository.GetServiceTypeByPK((int)serviceTypePK);

                serviceType.Deleted = true;

                serviceTypesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("DELETE", serviceType.ServiceTypePK);
            }

            return(Redirect(Request.UrlReferrer.AbsoluteUri));
        }
Exemple #2
0
        public ActionResult Edit(int?serviceTypePK)
        {
            if (serviceTypePK != null)
            {
                IServiceTypesRepository serviceTypesRepository = new ServiceTypesRepository(db);
                ServiceType             serviceType            = serviceTypesRepository.GetServiceTypeByPK((int)serviceTypePK);
                ServiceTypeView         serviceTypeView        = new ServiceTypeView();

                serviceTypeView.ConvertFrom(serviceType, serviceTypeView);

                return(View(serviceTypeView));
            }
            else
            {
                return(RedirectToAction("Index", "ServiceType"));
            }
        }
Exemple #3
0
        public ActionResult Edit(ServiceTypeView serviceTypeModel)
        {
            if (ModelState.IsValid)
            {
                IServiceTypesRepository serviceTypesRepository = new ServiceTypesRepository(db);
                ServiceType             serviceType            = serviceTypesRepository.GetServiceTypeByPK((int)serviceTypeModel.ServiceTypePK);
                serviceTypeModel.ConvertTo(serviceTypeModel, serviceType);

                serviceTypesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("UPDATE", serviceType.ServiceTypePK);

                return(RedirectToAction("Index", "ServiceType"));
            }
            else
            {
                return(View(serviceTypeModel));
            }
        }