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