Пример #1
0
 /// <summary>
 /// Adds a customer to database
 /// </summary>
 /// <param name="cust"></param>
 public int Add(Customer cust)
 {
     context.Customer.Add(cust);
     context.SaveChanges();
     context.Entry(cust).Reload();
     return(cust.Id);
 }
Пример #2
0
        public Order FindByID(int id)
        {
            var res = context.Order
                      .Include(o => o.Cust)
                      .Include(o => o.Loc)
                      .Include("OrderItem.P")
                      .Include("OrderItem.P.P")
                      .FirstOrDefault(m => m.Id == id);

            context.Entry(res).Reload();
            return(res);
        }
Пример #3
0
 /// <summary>
 /// Sets location's state to edited
 /// </summary>
 /// <param name="cust"></param>
 public void Edit(Loc l)
 {
     context.Entry(l).State = EntityState.Modified;
 }