Exemple #1
0
        //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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        //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);
        }
Exemple #4
0
        //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);
        }
Exemple #5
0
 //Sửa thông tin kho hàng
 public static BLOCK_DTO SuaKhoHang(BANG_BLOCK bl)
 {
     return(BLOCK_DAL.SuaKhoHang(bl));
 }
Exemple #6
0
 //Thêm kho hàng.
 public static BLOCK_DTO ThemKhoHang(BANG_BLOCK bl)
 {
     return(BLOCK_DAL.ThemKhoHang(bl));
 }