public static bool Update(MailTemplate mailTemplate)
 {
     try
     {
         return MailTemplateDL.Update(mailTemplate);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public static bool Update(MailTemplate mailTemplate)
        {
            try
            {
                MailTemplate existingMailTemplate = new MailTemplate();
                using (var context = new PropertyDBEntities())
                {
                    existingMailTemplate = context.MailTemplates
                                    .Where(t => t.ID == mailTemplate.ID)
                                    .FirstOrDefault();
                }

                if (existingMailTemplate != null)
                {
                    existingMailTemplate.Body = mailTemplate.Body;
                    existingMailTemplate.Company = mailTemplate.Company;
                    existingMailTemplate.Footer = mailTemplate.Footer;
                    existingMailTemplate.FromEmailAddress = mailTemplate.FromEmailAddress;
                    existingMailTemplate.Password = mailTemplate.Password;
                    existingMailTemplate.Subject = mailTemplate.Subject;
                    existingMailTemplate.Username = mailTemplate.Username;
                    existingMailTemplate.WebsiteUrl = mailTemplate.WebsiteUrl;

                    using (var context = new PropertyDBEntities())
                    {
                        context.Entry(existingMailTemplate).State = EntityState.Modified;

                        context.SaveChanges();
                    }

                    return true;
                }
                else
                {
                    return false;
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }