//Thêm kho hàng. public static BLOCK_DTO ThemKhoHang(BANG_BLOCK bl) { bl = QuanLyShop.BANG_BLOCK.Add(bl); QuanLyShop.SaveChanges(); BLOCK_DTO blDTO = ConvertDTO(bl); return(blDTO); }
public static BLOCK_DTO ConvertDTO(BANG_BLOCK bl) { BLOCK_DTO blDTO = new BLOCK_DTO(); blDTO.idblock = bl.idblock; blDTO.name = bl.name; blDTO.soluong = bl.soluong; return(blDTO); }
//Sửa thông tin kho hàng public static BLOCK_DTO SuaKhoHang(BANG_BLOCK bl) { BANG_BLOCK blUpdate = QuanLyShop.BANG_BLOCK.SingleOrDefault(b => b.idblock == bl.idblock); if (blUpdate != null) { blUpdate.idblock = bl.idblock; blUpdate.name = bl.name; blUpdate.soluong = bl.soluong; QuanLyShop.SaveChanges(); BLOCK_DTO blDTO = ConvertDTO(blUpdate); return(blDTO); } return(null); }
//Xóa kho hàng public static bool XoaKhoHang(string idBl) { BANG_BLOCK dBl = QuanLyShop.BANG_BLOCK.SingleOrDefault(b => b.idblock == idBl); if (dBl != null) { QuanLyShop.BANG_BLOCK.Remove(dBl); try { QuanLyShop.SaveChanges(); return(true); } catch (Exception ex) { return(false); } } return(false); }
//Sửa thông tin kho hàng public static BLOCK_DTO SuaKhoHang(BANG_BLOCK bl) { return(BLOCK_DAL.SuaKhoHang(bl)); }
//Thêm kho hàng. public static BLOCK_DTO ThemKhoHang(BANG_BLOCK bl) { return(BLOCK_DAL.ThemKhoHang(bl)); }