Esempio n. 1
0
        public void update(Order existingType, Order updatedType)
        {
            DBOrder dbOrder = mapperOrder.Map(existingType);
            DBOrder order   = context.DBOrders.ToList().Find(order => order.GetHashCode() == dbOrder.GetHashCode());

            if (order is not null)
            {
                DBOrder updatedOrder = mapperOrder.Map(updatedType);
                order.DBCustomer = updatedOrder.DBCustomer;
                order.Pizzas     = updatedOrder.Pizzas;
                order.DBStore    = updatedOrder.DBStore;
                order.TimeStamp  = updatedOrder.TimeStamp;
                order.PriceTotal = updatedOrder.PriceTotal;
                context.SaveChanges();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Creates two
        /// </summary>
        /// <param name="genericType"></param>
        public void Remove(Order genericType)
        {
            DBOrder dbOrder = mapperOrder.Map(genericType);
            DBOrder order   = context.DBOrders.ToList().Find(order => order.GetHashCode() == dbOrder.GetHashCode());

            if (order is not null)
            {
                context.Remove(order);
                context.SaveChanges();
            }
        }