protected void btn_add_Click(object sender, System.EventArgs e) { string value = txt_content.Value; if (txt_key.Text == "") { Config.ShowMessageV2(msg, "Please enter valid template key", "Error!", 0); return; } if (MailTemplateBLL.Validate_TemplateKey(txt_key.Text)) { Config.ShowMessageV2(msg, "Template key already exist", "Error!", 0); return; } string description = txt_description.Text; if (description.Length > 100) { description = description.Substring(0, 95); } MailTemplateBLL.Add(txt_key.Text, description, txt_subjecttags.Text, txt_contenttags.Text, txt_subject.Text, value, drp_sorttype.SelectedValue); Response.Redirect(Config.GetUrl("adm/sc/mail/Default.aspx?status=added")); }
public async Task <ActionResult> proc() { var json = new StreamReader(Request.Body).ReadToEnd(); var data = JsonConvert.DeserializeObject <JGN_MailTemplates>(json); if (data.id > 0) { // Update Operation MailTemplateBLL.Update_Record(_context, data.id, data.subject, data.description, data.contents, data.tags, data.subjecttags); } else { // check whether template already exist if (MailTemplateBLL.CheckTemplate(_context, data.templatekey)) { return(Ok(new { status = "error", message = SiteConfig.generalLocalizer["_record_exist"].Value })); } // Add Operation data = await MailTemplateBLL.Add(_context, data); } return(Ok(new { status = "success", record = data, message = SiteConfig.generalLocalizer["_records_processed"].Value })); }