Ejemplo n.º 1
0
        public ActionResult Create()
        {
            var model = new PostCmdModel {
                Categories = Dispatch <CategoryList>().Categories
            };

            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult Edit(PostCmdModel model)
        {
            if (ModelState.IsValid)
            {
                model.ActionId = 2;
                DispatchCommand <PostCmdModel>(model);
                return(RedirectToAction("Index", "Post"));
            }

            model.Categories = Dispatch <CategoryList>().Categories;
            return(View(model));
        }
Ejemplo n.º 3
0
        public ActionResult Create(PostCmdModel model)
        {
            if (ModelState.IsValid)
            {
                model.PostedBy = LoginUserInfo.UserId;
                model.ActionId = 1;
                DispatchCommand <PostCmdModel>(model);
                return(RedirectToAction("Index", "Post"));
            }

            model.Categories = Dispatch <CategoryList>().Categories;
            return(View(model));
        }
Ejemplo n.º 4
0
        public ActionResult Edit(int id)
        {
            var result = Dispatch <PostDetails, PostDetailsParameters>(new PostDetailsParameters {
                PostId = id
            });
            var model = new PostCmdModel
            {
                Categories  = Dispatch <CategoryList>().Categories,
                Id          = id,
                Title       = result.Title,
                CategoryId  = result.CategoryId,
                Details     = result.Details,
                IsPublished = result.IsPublished
            };

            return(View(model));
        }