public bool EditOrder(TeaOrderViewModel teaOrder) { TeaOrder orderModel = new TeaOrder(); orderModel = _mapper.Map <TeaOrder>(teaOrder); _repo.EditOrder(orderModel); //orderModel.TeaOrderTeas = // teaOrder.TeaIds.ToList().Select(x => new TeaOrderTea { TeaOrderId = orderModel.Id, TeaId = x }).ToList(); return(true); }
public bool AddOrder(TeaOrderViewModel order) { TeaOrder orderModel = new TeaOrder(); orderModel = _mapper.Map <TeaOrder>(order); orderModel.TeaOrderTeas = order.TeaIds.ToList().Select(x => new TeaOrderTea { TeaOrderId = orderModel.Id, TeaId = x }).ToList(); return(_repo.AddOrder(orderModel)); }
public bool EditOrder(TeaOrder teaOrder) { _context.TeaOrders.Update(teaOrder); _context.SaveChanges(); return(true); }
public bool AddOrder(TeaOrder order) { _context.TeaOrders.Add(order); _context.SaveChanges(); return(true); }