Exemple #1
0
        List <OrderDetail> IStockRepository.GetOrderHistory()
        {
            List <OrderDetail> orderHistory;

            using (YEXDBContext context = new YEXDBContext())
            {
                orderHistory = context.orderHistory.ToList();
            }
            return(orderHistory);
        }
Exemple #2
0
 void IStockRepository.LoadStock(List <StockDetail> stock)
 {
     using (YEXDBContext context = new YEXDBContext())
     {
         foreach (var eachStock in stock)
         {
             context.stocks.Add(eachStock);
         }
         context.SaveChanges();
     }
 }
Exemple #3
0
        StockDetail IStockRepository.GetStockDetail(string stockName)
        {
            StockDetail result = null;

            using (YEXDBContext context = new YEXDBContext())
            {
                if (context.stocks.Any())
                {
                    result = context.stocks.FirstOrDefault(a => a.StockName.Equals(stockName));
                }
            }
            return(result);
        }
Exemple #4
0
 void IStockRepository.SaveOrder(OrderDetail orderDetail)
 {
     try
     {
         using (YEXDBContext context = new YEXDBContext())
         {
             context.orderHistory.Add(orderDetail);
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         // handle log
     }
 }
Exemple #5
0
        List <StockDetail> IStockRepository.GetAllStock()
        {
            List <StockDetail> sampleData = new List <StockDetail>();

            try
            {
                using (YEXDBContext context = new YEXDBContext())
                {
                    sampleData = context.stocks.ToList();
                }
            }
            catch (Exception ex)
            {
            }
            return(sampleData);
        }