public ActionResult Edit(StoryEditViewModel model)
        {
            if (ModelState.IsValid)
            {
                var result = storyService.Edit(new StoryModel
                {
                    Id          = model.Id,
                    Title       = model.Title,
                    Content     = model.Content,
                    Description = model.Description,
                    GroupIds    = model.GroupIds,
                });

                if (result)
                {
                    return(RedirectToAction("Index", "Story"));
                }
                else
                {
                    ModelState.AddModelError("", "Story creation failed");
                }
            }

            model.GroupListItems = GetGroupsListItems();
            return(View(model));
        }
Example #2
0
 public ActionResult Edit(StoryEditModel model)
 {
     if (ModelState.IsValid)
     {
         _storyService.Edit(model);
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
Example #3
0
        public async Task <IActionResult> Edit(EditStory editStory)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("Index", "Board"));
            }

            bool successful = await StoryService.Edit(editStory);

            if (!successful)
            {
                return(BadRequest("Could not Edit stories"));
            }

            return(RedirectToAction("Board", "Board"));
        }