public static void DeleteCustomerInfoFromId(int id) { using (var db = new MVPOnBoardAPIContext()) { //var getSales = db.Sales.Where(record => record.CustomerId == id).ToArray(); //foreach (var item in getSales) //{ // item.CustomerId = 0; //} //db.SaveChanges(); _ = db.Customers.Remove(CustomerDAL.GetCustomerFromId(id)); db.SaveChanges(); } }
public void Create(Customers customer) { CustomerDAL.CreateCustomerInfo(customer); }
public void Update(Customers customer) { CustomerDAL.UpdateCustomerInfoFromId(customer); }
public void Delete(int id) { CustomerDAL.DeleteCustomerInfoFromId(id); }
public Customers Edit(int id) { return(CustomerDAL.GetCustomerFromId(id)); }
public IEnumerable <Customers> Index() { var tempList = CustomerDAL.GetAllCustomers(); return(tempList); }