Beispiel #1
0
        public static IEnumerable<SelectListItem> getDrpCategories()
        {
            using(BlogContext db = new BlogContext())
            {
                IEnumerable<SelectListItem> drpcategories = db.Categories.Select(x => new SelectListItem()
                {
                    Text = x.Name,
                    Value = x.ID.ToString()
                }).ToList();

                return drpcategories;
            }
        }
 public SiteBaseController()
 {
     db = new BlogContext();
 }
Beispiel #3
0
 public BaseController()
 {
     //ViewBag.Username = HttpContext.User.Identity.Name;
     db = new BlogContext();
 }