示例#1
0
文件: Manager.cs 项目: Woody88/BTI420
        public CustomerBase CustomerAdd(CustomerAdd newCustomer)
        {
            var addedCustomer = ds.Customers.Add(Mapper.Map<Customer>(newCustomer));
            ds.SaveChanges();

            return (addedCustomer == null) ? null : Mapper.Map<CustomerBase>(addedCustomer);
        }
示例#2
0
        public ActionResult Create(CustomerAdd newCustomer)
        {
            if (!ModelState.IsValid)
            {
                return View(newCustomer);
            }

            var addedCustomer = m.CustomerAdd(newCustomer);

            if (addedCustomer == null)
            {
                return View(newCustomer);
            }
            else
            {
                return RedirectToAction("details", new { id = addedCustomer.CustomerId });
=======