public CustomerBase CustomerAdd(CustomerAdd newCustomer) { var addedCustomer = ds.Customers.Add(Mapper.Map<Customer>(newCustomer)); ds.SaveChanges(); return (addedCustomer == null) ? null : Mapper.Map<CustomerBase>(addedCustomer); }
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 }); =======