public void InsertCustomer(Customer c) { if (!ModelState.IsValid) { throw new HttpResponseException(HttpStatusCode.BadRequest); } FakeDB.InsertCustomer(c); }
public ActionResult AddCustomer(CustomerDataView customerDV) { if (!ModelState.IsValid) { return(View("CustomerAdd", new CustomerDataView() { Sexes = FakeDB.GetSelectListItemSex(), Customer = customerDV.Customer, SexId = customerDV.SexId })); } FakeDB.InsertCustomer(customerDV.Customer); return(Redirect("/Customers")); }