public ActionResult RegisterService(RegistratedServiceModel model)
 {
     if (ModelState.IsValid)
     {
         var response = _servicesService.Insert(model);
         return Json(new { success = response.IsSucceed, data = response.Message }, JsonRequestBehavior.AllowGet);
     }
     else
         return Json(new { success = false }, JsonRequestBehavior.AllowGet);
 }
        public ActionResult Edit(RegistratedServiceModel model)
        {
            if (ModelState.IsValid)
            {
                var response = _servicesService.Update(model);

                return Json(new { success = response.IsSucceed, message = response.Message }, JsonRequestBehavior.AllowGet);
            }

            return new JsonNetResult(new { success = false, errors = GetModelErrors() }, JsonRequestBehavior.AllowGet);
        }
        private void ComposeClientEmail(RegistratedServiceModel model)
        {
            var listOfAddresses = new List<string>()
            {
                model.ClientEmail,
                _settingsService.GetPropertyByName("EmailUsername")
            };

            _mailManagementService.SendMail(listOfAddresses,
                ClientConfirmationEmail.CONTENT + model.ServiceType.Name + ClientConfirmationEmail.CONTENT_2 + model.StartDate + ClientConfirmationEmail.CONTENT_3 + ClientConfirmationEmail.FOOTER,
                ClientConfirmationEmail.SUBJECT);
        }
 public ResponseBase Update(RegistratedServiceModel model)
 {
     ResponseBase response;
     using (var unitOfWork = _unitOfWorkFactory.Create())
     {
         try
         {
             if (model != null)
             {
                 unitOfWork.RegistratedServiceRepository.Update(model.ToEntity());
             }
             unitOfWork.Save();
             response = new ResponseBase() { IsSucceed = true, Message = Modules.Resources.Logic.ServiceUpdateSuccess };
         }
         catch (Exception e)
         {
             _logger.LogToFile(_logger.CreateErrorMessage(e));
             response = new ResponseBase() { IsSucceed = false, Message = Modules.Resources.Logic.ServiceUpdateFailed };
         }
         return response;
     }
 }