MVC4 – HttpGet & HttpPost actions

        [HttpGet]
        public ActionResult Create()
        {
            var categories = new SelectList(new[] { "Mobile phone", "Laptop", "Tablet" });
            ViewBag.categories = categories;
            return View();
        }

        [HttpPost]
        public ActionResult Create([Bind(Exclude = "CurrentPrice")] MyAuction.Models.Auction auction)
        {
            if(string.IsNullOrWhiteSpace(auction.Title))
            {
                ModelState.AddModelError("Title", "Title is required");
            }
            else if(auction.Title.Length<5 || auction.Title.Length>200){
                ModelState.AddModelError("Title", "Title must be between 5 and 200");
            }

            if (ModelState.IsValid)
            {
                //save to the database
            }

            var categories = new SelectList(new[] { "Mobile phone", "Laptop", "Tablet" });
            ViewBag.categories = categories;

            return View();
        }