public ActionResult Create([Bind(Include = "Id,FirstName,LastName,CategoryId,CountryId,Description,TotalProducts,Rowid,CreatedOn,CreatedBy,ChangedOn,ChangedBy")] Dealer dealer) { if (ModelState.IsValid) { dealerProcess.Add(dealer); return(RedirectToAction("Index")); } return(View(dealer)); }
public ActionResult Create(FormCollection collection) { try { var newDealer = new ASF.Entities.Dealer(); newDealer.FirstName = collection["FirstName"]; newDealer.LastName = collection["LastName"]; newDealer.CategoryId = int.Parse(collection["categoryId"]); newDealer.CountryId = int.Parse(collection["countryId"]); newDealer.Description = collection["Description"]; newDealer.TotalProducts = 0; newDealer.CreatedOn = DateTime.Now; newDealer.ChangedOn = DateTime.Now; dealerProcess.Add(newDealer); return(RedirectToAction("Index")); } catch { return(RedirectToAction("Create")); } }