public ActionResult Create(CustomerMod custMod) { try { // TODO: Add insert logic here if (!ModelState.IsValid) { var cust = irepOrig.GetCustomers(); custMod.FirstName = cust.Select(c => c.FristName).First(); custMod.LastName = cust.Select(c => c.LsatName).First(); return(View(custMod)); } Project0.Library.Customer tempcust = new Project0.Library.Customer(custMod.FirstName, custMod.LastName); irepOrig.AddCust(tempcust); irepOrig.why(); return(RedirectToAction(nameof(Index))); } catch { var cust = irepOrig.GetCustomers(); custMod.FirstName = cust.Select(c => c.FristName).First(); custMod.LastName = cust.Select(c => c.LsatName).First(); return(View(custMod)); } }
public void Insert(Project0.Library.Customer obj) { Customer entity = Mapper.MapCustomerToDbEntry(obj); _dbContext.Add(entity); Save(); }