Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
//
 // POST: /Blog/CreateBlog
 [HttpPost]
 [ValidateAntiForgeryToken]
 public ActionResult CreateBlog(BlogViewModel model)
 {
     var userId = User.Identity.GetUserId();
     model.UserId = userId;

     if (ModelState.IsValid && model.UserId != null)
     {
         Mapper.CreateMap<BlogViewModel, Blog>();
         if (_blogProcess.CreateBlog(Mapper.Map<BlogViewModel, Blog>(model)))
         {
             RedirectToAction("Index", "Blog");
         }
     }

     // If we got this far, something failed, redisplay form
     return View(model);
 }
Posted
Updated 20-Jan-20 23:47pm

1 solution

if (_blogProcess.CreateBlog(Mapper.Map<blogviewmodel,>(model)))
        {
          return RedirectToAction("Index", "Blog");
        }

Use this block of code,because now the action method even though passes through the RedirectToAction statement there is no return keyword. So that does not work.
Thanks
:)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900