public void CreateCreditOrder(KitchenOrder k, int id, string userId) { // only make a creditorder when there doesn't excists one if (k.Paid == true && _orderRepository.FindCreditForOrder(id) == null) { CreditOrder c = new CreditOrder(); c.Date = DateTime.Now; c.CreditForOrderId = id; c.AdminId = userId; c.TotalAmount -= k.TotalAmount; c.ApplicationUserId = k.ApplicationUserId; _orderRepository.CreateCreditOrder(c); } }
public void UpdateCreditOrder(int id, CreditOrder order) { _ctx.Entry(_ctx.CreditOrders.Find(id)).CurrentValues.SetValues(order); _ctx.SaveChanges(); }
public void CreateCreditOrder(CreditOrder order) { _ctx.CreditOrders.Add(order); _ctx.SaveChanges(); }