예제 #1
0
        public ActionResult Create(Customer customer)
        {
            if (ModelState.IsValid)
            {
                db.Customers.Add(customer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(RedirectToAction("Index"));
        }
예제 #2
0
        public ProductSold CreateSales(ProductSold productSold)
        {
            if (!ModelState.IsValid)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }

            db.ProductSolds.Add(productSold);
            db.SaveChanges();

            return(productSold);
        }
예제 #3
0
        public Customer CreateCustomer(Customer customer)
        {
            if (!ModelState.IsValid)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }

            db.Customers.Add(customer);
            db.SaveChanges();

            return(customer);
        }
예제 #4
0
        public Store CreateStore(Store store)
        {
            if (!ModelState.IsValid)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }

            db.Stores.Add(store);
            db.SaveChanges();

            return(store);
        }