public ActionResult AddeditEmailtemplate(StaffandTrain.Models.EmailTemplate objemail) { try { if (objemail.TemplateIdDecrypt == 0) { context.SpInsertEmailTemplate(objemail.TemplateName, objemail.Subject, objemail.EmailBody); context.SaveChanges(); TempData["Message"] = "Record Saved"; } else { context.SpUpdateEmailTemplate(objemail.TemplateName, objemail.Subject, objemail.EmailBody, objemail.TemplateIdDecrypt); context.SaveChanges(); TempData["Message"] = "Record Updated"; } } catch (Exception ex) { cm.ErrorExceptionLogingByService(ex.ToString(), "EmailTemplate" + ":" + new StackTrace().GetFrame(0).GetMethod().Name, "AddeditEmailtemplate", "NA", "NA", "NA", "WEB"); } if (objemail.TemplateIdDecrypt != 0) { return(RedirectToAction("SaveEmailtemplate", new { TemplateId = CryptorEngine.Encrypt(cm.Code_Decrypt(Convert.ToString(objemail.TemplateIdDecrypt))) })); } else { return(RedirectToAction("SaveEmailtemplate")); } }