public JsonResult GetTemplate()
        {
            DropDownListsRepository modelRepo = new DropDownListsRepository();

            return Json(modelRepo.ReadTemplate().OrderBy(o => o.Name).Select(c => new { MailTemplateID = c.ID, Template = c.Name }).OrderBy(o => o.Template), JsonRequestBehavior.AllowGet);
        }
        public static SelectList GetListEmailTemplates(int? SelectedItem)
        {
            DropDownListsRepository modelRepo = new DropDownListsRepository();

            var emailTemplates = modelRepo.ReadTemplate();

            List<SelectListItem> _ListItems = new List<SelectListItem>();

            TablesRepositary tbleobject = new TablesRepositary();
            List<TablesExt> list = new List<TablesExt>();
            foreach (var dr in emailTemplates)
                {
                    SelectListItem itr = new SelectListItem();
                    itr.Text = dr.Name;
                    itr.Value = dr.ID.ToString();
                    itr.Selected = false;

                    _ListItems.Add(itr);
                }

            return new SelectList(_ListItems, "Value", "Text", SelectedItem);
        }