Example #1
0
 public ActionResult Edit(Guid id)
 {
     IdeaView idea = GetIdea(id);
     var model = new IdeaEditModel
                     {
                         Abstract = idea.Abstract,
                         Categories = _categories,
                         CategoryId = _categories.FirstOrDefault(c => c.Value == idea.Category).Key,
                         CurrentUrl = idea.Url,
                         DisplayOnMainMenu = idea.DisplayOnMainMenu,
                         DisplayOnSideMenu = idea.DisplayOnSideMenu,
                         IsActive = idea.IsActive,
                         SortOrder = idea.SortOrder,
                         Text = idea.Text,
                         Title = idea.Title
                     };
     return View(model);
 }
Example #2
0
        public ActionResult Edit(Guid id, IdeaEditModel model)
        {
            if (!ModelState.IsValid)
            {
                model.Categories = _categories;
                return View(model);
            }

            string ideaUrl =
                BusinessShell.RunWithResult(
                    () => new UpdateIdeaOperation(id, model.Abstract, model.IsActive, model.Text, model.Title, User.Identity.Name,
                                                  _categories[model.CategoryId], model.DisplayOnMainMenu, model.DisplayOnSideMenu,
                                                  model.SortOrder));

            return Redirect(ideaUrl);
        }