public ActionResult EditCategory(MvcCategory category)
        {
            if (ModelState.IsValid)
            {
                categories.Update(CategoryMapper.GetBLLEntity(category));
                return(RedirectToRoute("Categories"));
            }

            return(View());
        }
Exemplo n.º 2
0
        public static MvcCategory GetMVCEntity(BLLCategory category)
        {
            MvcCategory res = new MvcCategory()
            {
                Id   = category.Id,
                Name = category.Name
            };

            foreach (var sphere in category.Sphere)
            {
                res.Sphere.Add(SphereMapper.GetMVCEntity(sphere));
            }
            return(res);
        }
Exemplo n.º 3
0
        public static BLLCategory GetBLLEntity(MvcCategory category)
        {
            BLLCategory result = new BLLCategory()
            {
                Id   = category.Id,
                Name = category.Name,
            };

            foreach (var sphere in category.Sphere)
            {
                result.Sphere.Add(SphereMapper.GetBLLEntity(sphere));
            }
            return(result);
        }
        public ActionResult EditCategory(int id)
        {
            MvcCategory category = CategoryMapper.GetMVCEntity(categories.Get(id));

            return(View(category));
        }