/// <summary> /// deletes an order /// </summary> /// <param name="orderId"></param> public void CancelOrder(int orderId) { //the order is in the database, remove it var order = _context.Orders.Where(o => o.Id == orderId).FirstOrDefault(); if (order != null) { _context.Remove(order); _context.SaveChanges(); } }
public void CancelOrder(int orderId, Guid storeId) { if (orderId == 0) { //cancel the order in cache _cache.Remove(storeId.ToString()); } else { //the order is in the database, remove it var order = _context.Orders.Where(o => o.Id == orderId).FirstOrDefault(); if (order != null) { _context.Remove(order); _context.SaveChanges(); } } }