Exemplo n.º 1
0
        public void Create(StockItemDTO stockItemDTO)
        {
            Item_Stock item_Stock = new Item_Stock();

            item_Stock.Item_Name         = stockItemDTO.Item_Name;
            item_Stock.Item_Quantity     = stockItemDTO.Item_Quantity;
            item_Stock.Item_Disposed_On  = stockItemDTO.Item_Disposed_On;
            item_Stock.Item_Purchased_On = stockItemDTO.Item_Purchased_On;
            item_Stock.Item_Remarks      = stockItemDTO.Item_Remarks;
            item_Stock.Store_ID          = stockItemDTO.Store_ID;

            dbcontext.Item_Stock.Add(item_Stock);
            dbcontext.SaveChanges();
        }
Exemplo n.º 2
0
        public void Edit(StockItemDTO stockItemDTO)
        {
            Item_Stock item_Stock = new Item_Stock();

            item_Stock.Item_ID           = stockItemDTO.Item_ID;
            item_Stock.Item_Name         = stockItemDTO.Item_Name;
            item_Stock.Item_Quantity     = stockItemDTO.Item_Quantity;
            item_Stock.Item_Purchased_On = stockItemDTO.Item_Purchased_On;
            item_Stock.Item_Disposed_On  = stockItemDTO.Item_Disposed_On;
            item_Stock.Item_Remarks      = stockItemDTO.Item_Remarks;
            item_Stock.Store_ID          = stockItemDTO.Store_ID;

            dbcontext.Entry(item_Stock).State = EntityState.Modified;
            dbcontext.SaveChanges();
        }
Exemplo n.º 3
0
 public bool Delete(int id)
 {
     if (dbcontext.Item_Stock.Any(i => i.Item_ID == id))
     {
         Item_Stock item_Stock = new Item_Stock();
         item_Stock.Item_ID = id;
         dbcontext.Entry(item_Stock).State = EntityState.Deleted;
         dbcontext.SaveChanges();
         return(true);
     }
     else
     {
         return(false);
     }
 }