Пример #1
0
        public ActionResult AddOrUpdate(Entity.Page model)
        {
            _pageRepo.AddOrUpdate(model);
            var routeItem = new RouteItem(0, null, (string)ControllerContext.RequestContext.RouteData.Values["controller"],
                                          "Index",
                                          (int)ControllerContext.RequestContext.RouteData.Values["id"])
            {
                Type = Common.TypeEntityFromRouteEnum.PageType
            };

            _routeItemRepository.AddOrUpdate(routeItem);
            return(RedirectToAction("AdminIndex"));
        }
Пример #2
0
        public ActionResult AddOrUpdate(int id = 0)
        {
            //Mapper.Initialize(cfg => cfg.CreateMap<Pages, Pyramid.Entity.Page>());
            //var ef = _pageRepo.FindBy(p => p.Id == id).SingleOrDefault();


            var model = _pageRepo.Get(id);

            if (model == null)
            {
                model = new Entity.Page();
            }
            return(View(model));
        }