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(); } }
/// <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(); } }