public void Update(SMSTemplatesViewModel viewModel) { var smstemplates = _repository.Get(x => x.Id == viewModel.Id); smstemplates.Status = viewModel.Status; smstemplates.DateOfUpdate = DateTime.Now; smstemplates.IsItDeleted = viewModel.IsItDeleted; smstemplates.SiteLanguage = viewModel.SiteLanguage; smstemplates.Subject = viewModel.Subject; smstemplates.Message = viewModel.Message; _repository.Update(smstemplates); }
public void Add(SMSTemplatesViewModel viewModel) { _repository.Add(new SMSTemplates { CreationDate = DateTime.Now, IsItDeleted = false, Status = true, SiteLanguage = viewModel.SiteLanguage, Subject = viewModel.Subject, Message = viewModel.Message }); }
public ActionResult SMSTemplateSave(SMSTemplatesViewModel viewModel) { SessionKontrol(); if (_users != null) { try { var isValid = Validate(viewModel, new SMSTemplatesValidator(), ModelState); if (isValid) { viewModel.Status = true; if (viewModel.Id == 0) { _SMSTemplatesServices.Add(viewModel); } else { _SMSTemplatesServices.Update(viewModel); } } else { return(View(ViewForm, viewModel)); } } catch (Exception) { return(View(ViewForm, viewModel)); } _unitOfWork.SaveChanges(); return(RedirectToAction("SMSTemplateList", "SMS")); } else { return(RedirectToAction("Index", "Login")); } }