daily pastebin goal
1%
SHARE
TWEET

Untitled

a guest Feb 23rd, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top