public JsonResult GetTemplatedata(int id)
        {
            if (Request.IsAuthenticated)
            {
                var data = new SPgetemailtemplatebytemplateid_Result();

                try
                {
                    data = context.SPgetemailtemplatebytemplateid(id).FirstOrDefault();

                    if (data != null)
                    {
                        data.EmailBody = (data.EmailBody).Replace(" ", " ").Replace("nbsp;", " ");
                    }
                }
                catch (Exception ex)
                {
                    cm.ErrorExceptionLogingByService(ex.ToString(), "EmailSendFrom" + ":" + new StackTrace().GetFrame(0).GetMethod().Name, "Getbiztype", "NA", "NA", "NA", "WEB");
                }

                return(Json(data));
            }
            else
            {
                return(Json("LoginRequired"));
            }
        }
        public ActionResult SaveEmailtemplate(string TemplateId)
        {
            StaffandTrain.Models.EmailTemplate objemail = new StaffandTrain.Models.EmailTemplate();

            try
            {
                if (TempData["Message"] != null)
                {
                    ViewBag.Message = TempData["Message"];
                }

                if (!string.IsNullOrEmpty(TemplateId))
                {
                    int TemplateIddecrypt = Convert.ToInt32(CryptorEngine.Decrypt(cm.Code_Decrypt(Convert.ToString(TemplateId))));
                    var emailtempdata     = context.SPgetemailtemplatebytemplateid(TemplateIddecrypt).FirstOrDefault();

                    if (emailtempdata != null)
                    {
                        objemail.TemplateId        = emailtempdata.TemplateId;
                        objemail.TemplateIdDecrypt = emailtempdata.TemplateId;
                        objemail.TemplateName      = emailtempdata.TemplateName;
                        //objemail.EmailBody = cm.StripHTML(emailtempdata.EmailBody.Replace(" ", "").Replace("nbsp;", ""));
                        objemail.EmailBody = (emailtempdata.EmailBody.Replace(" ", " ").Replace("nbsp;", " "));
                        objemail.Subject   = emailtempdata.Subject;
                    }
                }
            }
            catch (Exception ex)
            {
                cm.ErrorExceptionLogingByService(ex.ToString(), "EmailTemplate" + ":" + new StackTrace().GetFrame(0).GetMethod().Name, "SaveEmailtemplate", "NA", "NA", "NA", "WEB");
            }

            return(View(objemail));
        }