Exemplo n.º 1
0
 public static OrderDetails GetOrderfromBranch(int id_branch)
 {
     using (DB_shoesEntities5 db = new DB_shoesEntities5())
     {
         try
         {
             OrderDetails     order      = new OrderDetails();
             OrdersFromBranch order_from = db.OrdersFromBranches.First(o => o.from_branch == id_branch && o.status == false);
             CustomersToOrder cust       = db.CustomersToOrders.First(c => c.id_customer == order_from.id_cust);
             order.id_shoe       = order_from.id_shoe;
             order.color         = order_from.color;
             order.size          = (Int32)order_from.size;
             order.name_customer = cust.name_customer;
             order.picture       = db.Shoes.First(s => s.id_shoe == order_from.id_shoe).picture;
             order_from.status   = true;
             order.phone         = cust.phone;
             order.email         = cust.email;
             order.order_id      = order_from.id_order;
             order.order_date    = order_from.order_date.ToString();
             db.SaveChanges();
             return(order);
         }
         catch (Exception e)
         {
             return(null);
         }
     }
 }
Exemplo n.º 2
0
 public static int AddCustomerToOrder(string mail, string phone, string name)
 {
     using (DB_shoesEntities5 db = new DB_shoesEntities5())
     {
         CustomersToOrder cust = new CustomersToOrder();
         cust.email         = mail;
         cust.phone         = phone;
         cust.name_customer = name;
         db.CustomersToOrders.Add(cust);
         db.SaveChanges();
         int x = cust.id_customer;
         return(x);
     }
 }