public ActionResult Edit(JobAlertViewModel model) { var statusMessage = "A Job Alert has been updated successfully."; var alertStatus = JobAlertStatus.SUCCESS; List <JobAlertEditFilterRootItem> filtersVMList = GetJobFilterData(); model.Data = JobAlertUtility.ConvertJobAlertViewModelToSearchModel(model, filtersVMList); var response = GetUpsertResponse(model, true); if (!response.Success) { statusMessage = response.Errors.First(); alertStatus = JobAlertStatus.UPDATE_FAILED; } TempData["StatusMessage"] = statusMessage; TempData["StatusCode"] = alertStatus; // Why action name is empty? // Here we need to call Index action, if we are providing action name as Index here // It is appending in the URL, but we dont want to show that in URL. So, sending it as empty // Will definity call defaut action i,.e Index return(RedirectToAction("")); }
public ActionResult Create(JobAlertViewModel model) { List <JobAlertEditFilterRootItem> filtersVMList = GetJobFilterData(); if (model.SalaryStringify != null) { model.Salary = JsonConvert.DeserializeObject <JobAlertSalaryFilterReceiver>(model.SalaryStringify); } if (String.IsNullOrEmpty(model.Email)) { model.Email = SitefinityHelper.GetLoggedInUserEmail(); } model.Data = JobAlertUtility.ConvertJobAlertViewModelToSearchModel(model, filtersVMList); // Create Email Notification EmailNotificationSettings jobAlertEmailNotificationSettings = null; if (this.JobAlertEmailTemplateId != null) { jobAlertEmailNotificationSettings = new EmailNotificationSettings(new EmailTarget(this.JobAlertEmailTemplateSenderName, this.JobAlertEmailTemplateSenderEmailAddress), new EmailTarget(string.Empty, model.Email), SitefinityHelper.GetCurrentSiteEmailTemplateTitle(this.JobAlertEmailTemplateId), SitefinityHelper.GetCurrentSiteEmailTemplateHtmlContent(this.JobAlertEmailTemplateId), null); if (!this.JobAlertEmailTemplateCC.IsNullOrEmpty()) { foreach (var ccEmail in this.JobAlertEmailTemplateCC.Split(';')) { jobAlertEmailNotificationSettings?.AddCC(String.Empty, ccEmail); } } if (!this.JobAlertEmailTemplateBCC.IsNullOrEmpty()) { foreach (var bccEmail in this.JobAlertEmailTemplateBCC.Split(';')) { jobAlertEmailNotificationSettings?.AddBCC(String.Empty, bccEmail); } } } model.EmailNotifications = jobAlertEmailNotificationSettings; var response = GetUpsertResponse(model); var stausMessage = "A Job Alert has been created successfully."; var alertStatus = JobAlertStatus.SUCCESS; if (!response.Success) { stausMessage = response.Errors.First(); alertStatus = JobAlertStatus.CREATE_FAILED; } TempData["StatusCode"] = alertStatus; TempData["StatusMessage"] = stausMessage; // Why action name is empty? // Here we need to call Index action, if we are providing action name as Index here // It is appending in the URL, but we dont want to show that in URL. So, sending it as empty // Will definity call defaut action i,.e Index return(RedirectToAction("")); }