Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. public class SomeController : Controller
  2. {
  3. // GET: /SomeIndex/
  4. [HttpGet]
  5. public ActionResult Index(int id)
  6. {
  7. SomeIndexViewModel vm = new SomeIndexViewModel(id) { myid = id };
  8. //Do some processing here
  9. return View(vm);
  10. }
  11.  
  12. // POST: /SomeIndex/
  13. [HttpPost]
  14. public ActionResult Index(SomeIndexViewModel vm)
  15. {
  16. bool validationsuccess = false;
  17. //validate
  18. if (validationsuccess)
  19. return RedirectToAction("Index", new {id=1234 });
  20. else
  21. return View(vm);
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement