public ActionResult MostUsed()
        {
            IQueryable <Category> mostUsedCategories = db.Categories.
                                                       Include("Posts").
                                                       OrderByDescending(category => category.Posts.Count).
                                                       Take(5);

            return(PartialView(CategoryModel.FromEntity(mostUsedCategories)));
        }
Beispiel #2
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Category category = db.Categories.Find(id);

            if (category == null)
            {
                return(HttpNotFound());
            }

            return(View(CategoryModel.FromEntity(category)));
        }
Beispiel #3
0
 public ActionResult Index()
 {
     return(View(CategoryModel.FromEntity(db.Categories.AsQueryable())));
 }