예제 #1
0
 public virtual ActionResult Update(CreateBlogViewModel model)
 {
     if (!ModelState.IsValid)
     {
         return View("Edit", model);
     }
     _blogService.UpdateBlog(model.Nickname, model.ApproveComments, model.CommentsEnabled, model.Description,
                             model.Title);
     return RedirectToRoute(new {controller = "Dashboard", action = "Index"});
 }
예제 #2
0
        public virtual ActionResult Create(CreateBlogViewModel model)
        {
            if (RedirectIfInvalidUser())
                return RedirectToAction("New", "Session");

            if (!ModelState.IsValid)
            {
                return View("New", model);
            }
            var user = HttpContext.User as UserViewModel;
            _blogService.CreateBlog(model.Title, model.Description, model.ApproveComments, model.CommentsEnabled,
                                    model.Nickname, user.Id);
            return RedirectToRoute(new {controller = "Dashboard", action = "Index"});
        }
예제 #3
0
 public virtual ActionResult Edit(CreateBlogViewModel model)
 {
     Blog blog = _blogService.GetBlog(model.Nickname);
     var modelOut = new CreateBlogViewModel(blog);
     return View(modelOut);
 }