예제 #1
0
        public ActionResult Create([Bind(Include = "ClientName,ProductName,Date,Cost,ManagerName")] FormCollection collection)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }
            try
            {
                _worker.AddNew(new SellingModel()
                {
                    ManagerName = collection["ManagerName"],
                    ClientName  = collection["ClientName"],
                    ProductName = collection["ProductName"],
                    Date        = Convert.ToDateTime(collection["Date"]),
                    Cost        = Convert.ToDouble(collection["Cost"])
                });

                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                return(View());
            }
        }