public ActionResult AddProducer() { var model = new AddProducerInputModel { Country = this.GetCountries() }; return(View(model)); }
public ActionResult AddProducer() { var model = new AddProducerInputModel { Country = this.GetCountries() }; return View(model); }
public ActionResult AddProducer(AddProducerInputModel model) { if (ModelState.IsValid) { var newProducer = new Producer { Name = model.Name, Address = model.Address, DateAdded = DateTime.UtcNow, Email = model.Email, Telephone = model.Telephone, Website = model.Website, CountryId = int.Parse(model.Country.CountryId) }; this.producers.Add(newProducer); } return(Redirect("/")); }
public ActionResult AddProducer(AddProducerInputModel model) { if (ModelState.IsValid) { var newProducer = new Producer { Name = model.Name, Address = model.Address, DateAdded = DateTime.UtcNow, Email = model.Email, Telephone = model.Telephone, Website = model.Website, CountryId = int.Parse(model.Country.CountryId) }; this.producers.Add(newProducer); } return Redirect("/"); }