Exemplo n.º 1
0
        public void SaveItem(ItemModel itemModel, IHostingEnvironment hostingEnvironment)
        {
            Item item = new Item();

            item.ItemName   = itemModel.ItemName;
            item.ItemStatus = itemModel.ItemStatus;
            item.UnitName   = itemModel.UnitName;
            item.UnitPrice  = itemModel.UnitPrice;
            string uniqueFileName = null;

            if (itemModel.File != null)
            {
                string uploadFolder = Path.Combine(hostingEnvironment.WebRootPath, "upload");
                uniqueFileName = Guid.NewGuid().ToString() + "_" + itemModel.File.FileName;
                string filePath = Path.Combine(uploadFolder, uniqueFileName);
                itemModel.File.CopyTo(new FileStream(filePath, FileMode.Create));
            }
            item.ImagePath = uniqueFileName;
            ItemDL itemDL = new ItemDL();

            itemDL.SaveItem(item);
        }
Exemplo n.º 2
0
 public ItemBL()
 {
     itemDL = new ItemDL();
 }
Exemplo n.º 3
0
        public Item GetItemByID(Guid itemID)
        {
            ItemDL itemDL = new ItemDL();

            return(itemDL.GetItemByID(itemID));
        }
Exemplo n.º 4
0
        public void DeleteItem(Guid itemID)
        {
            ItemDL itemDL = new ItemDL();

            itemDL.DeleteItem(itemID);
        }
Exemplo n.º 5
0
        public void DeleteItem(Guid Id)
        {
            ItemDL DL = new ItemDL();

            DL.DeleteItem(Id);
        }
Exemplo n.º 6
0
        public void UpdateItem(string Name, string Desc, double Price, Guid Id)
        {
            ItemDL DL = new ItemDL();

            DL.UpdateItem(Name, Desc, Price, Id);
        }
Exemplo n.º 7
0
        public void InsertItem(string Name, string Desc, double Price)
        {
            ItemDL DL = new ItemDL();

            DL.InsertItem(Name, Desc, Price);
        }
Exemplo n.º 8
0
        public List <ItemBL> ListAllItem()
        {
            ItemDL DL = new ItemDL();

            return(DL.ListAll());
        }