public ActionResult EditCategory(int id)
 {
     using (var entities = new Models.BeerModel())
     {
         var model     = entities.Categories.FirstOrDefault(x => x.Id == id);
         var viewmodel = new ViewModels.EditCategoryViewModel
         {
             Name = model.Name
         };
         return(View(viewmodel));
     }
 }
        public ActionResult EditCategory(ViewModels.EditCategoryViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            using (var entities = new Models.BeerModel())
            {
                var cat = entities.Categories.FirstOrDefault(x => x.Id == model.Id);
                cat.Name = model.Name;

                entities.SaveChanges();
                return(RedirectToAction("Index"));
            }
        }