예제 #1
0
        public ActionResult Create(FormCollection form)
        {
            ApiSale sale = new ApiSale()
            {
                CustomerId    = Int32.Parse(form["CustomerId"]),
                CarId         = Int32.Parse(form["CarId"]),
                SalesPersonId = Int32.Parse(form["SalesPersonId"]),
                SaleDate      = DateTime.Parse(form["SaleDate"]),
                SaleQuantity  = Int32.Parse(form["SaleQuantity"]),
                SaleTotal     = Decimal.Parse(form["SaleTotal"]),
            };

            if (client.CreateSale(sale))
            {
                return(RedirectToAction("Sales"));
            }
            else
            {
                return(View(sale));
            }
        }