Ejemplo n.º 1
0
        public ActionResult Create()
        {
            var model = new AdminGroupProductViewModel();

            ViewBag.Groups = Repository.GroupProduct.FetchAll().Where(g => g.ParentGroupID == null);
            return(View(model));
        }
Ejemplo n.º 2
0
 public ActionResult Create(AdminGroupProductViewModel model)
 {
     if (ModelState.IsValid)
     {
         var group = Mapper.Map <GroupProduct>(model);
         Repository.GroupProduct.Insert(group);
         Repository.GroupProduct.SaveChanges();
         if (group.GroupID != 0)
         {
             return(RedirectToAction("Index", "Category"));
         }
     }
     ViewBag.Groups = Repository.GroupProduct.FetchAll().Where(g => g.ParentGroupID == null);
     return(View(model));
 }