public ActionResult CreateCustomTag(CustomTagEditViewModel model) { if (ModelState.IsValid) { try { var orgId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId; if (model.TagId > 0) { _customTagService.UpdateCustomeTag(model); } else { _customTagService.SaveCustomeTag(model, orgId); } model.FeedbackMessage = FeedbackMessageModel.CreateSuccessMessage("CustomTag has been saved successfully!"); } catch (Exception ex) { model.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage(string.Format("System Failure! Message: {0}", ex.Message)); _logger.Info(string.Format("New CustomTag {0}! Message: {1} \nStackTrace: {2}", model.CustomTag, ex.Message, ex.StackTrace)); } } return(View(model)); }
public void UpdateCustomeTag(CustomTagEditViewModel model) { _corporateTagRepository.Update(new CorporateTag { Id = model.TagId, StartDate = model.StartDate.Value, EndDate = model.EndDate.Value, }); }
public ActionResult CreateCustomTag(long customeTagId = 0) { var customeTag = new CustomTagEditViewModel(); if (customeTagId > 0) { customeTag = _customTagService.GetCustomTag(customeTagId); } return(View(customeTag)); }
public void SaveCustomeTag(CustomTagEditViewModel model, long orgId) { _corporateTagRepository.Save(new CorporateTag { CorporateId = model.HealthPlanId, Tag = model.CustomTag.Trim(), DateCreated = DateTime.Now, StartDate = model.StartDate.Value, EndDate = model.EndDate.Value, CreatedBy = orgId, IsActive = true }); }
public CustomTagEditViewModel GetCustomTag(long tagId) { var corporateTag = _corporateTagRepository.GetById(tagId); var customeTagViewModel = new CustomTagEditViewModel(); if (corporateTag != null) { customeTagViewModel.CustomTag = corporateTag.Tag; customeTagViewModel.StartDate = corporateTag.StartDate; customeTagViewModel.EndDate = corporateTag.EndDate; customeTagViewModel.HealthPlanId = corporateTag.CorporateId; customeTagViewModel.TagId = corporateTag.Id; } return(customeTagViewModel); }