public int DeleteCustomer(int customerid) { tblCustomer tc = _db.tblCustomers.Where(c => c.C_ID == customerid).FirstOrDefault(); _db.tblCustomers.Remove(tc); return(_db.SaveChanges()); }
public int UpdateCustomer(CustomerDetails cd) { tblCustomer tc = _db.tblCustomers.Where(c => c.C_ID == cd.C_ID).FirstOrDefault(); tc.C_ID = cd.C_ID; tc.CustomerNo = cd.CustomerNo; tc.C_Name = cd.C_Name; tc.Address = cd.Address; tc.Gender = cd.Gender; tc.City = cd.City; tc.Email = cd.Email; tc.ContactNo = cd.ContactNo; tc.Photo = cd.Photo; return(_db.SaveChanges()); }
public int AddNewCustomer(CustomerDetails cd) { tblCustomer tc = new tblCustomer(); tc.CustomerNo = cd.CustomerNo; tc.C_Name = cd.C_Name; tc.Address = cd.Address; tc.Gender = cd.Gender; tc.City = cd.City; tc.Email = cd.Email; tc.ContactNo = cd.ContactNo; tc.Photo = cd.Photo; _db.tblCustomers.Add(tc); return(_db.SaveChanges()); }
public int GetCustomerById(int customerid) { tblCustomer tc = _db.tblCustomers.Where(c => c.C_ID == customerid).FirstOrDefault(); return(customerid); }