public static bool Add_NhaCungCap(Nha_CungCap ncc) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { entities.Nha_CungCap.Add(ncc); entities.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public static bool Delete_NhaCungCap(int ma_NCC) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { Nha_CungCap nha_CungCap = entities.Nha_CungCap.Where(p => p.ma_NCC == ma_NCC).FirstOrDefault(); entities.Nha_CungCap.Remove(nha_CungCap); entities.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public static bool Update_NhaCungCap(Nha_CungCap ncc) { try { using (CuaHang_XeMayEntities entities = new CuaHang_XeMayEntities()) { Nha_CungCap nha_CungCap = entities.Nha_CungCap.Where(p => p.ma_NCC == ncc.ma_NCC).FirstOrDefault(); nha_CungCap.ten_NCC = ncc.ten_NCC; entities.SaveChanges(); return(true); } } catch (Exception) { return(false); } }