Esempio n. 1
0
        public void InsertCustomer(Customer c)
        {
            if (!ModelState.IsValid)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }

            FakeDB.InsertCustomer(c);
        }
Esempio n. 2
0
        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"));
        }