public void Delete(int id) { var orderItem = new OrderItemDa(databasecontext); if (id > 0) { var currentOrderItem = GetById(id); orderItem.Delete(currentOrderItem); } }
public OrderItem Save(int id, int OrderId, string Item) { var orderItem = id > 0 ? GetById(id) : new OrderItem(); orderItem.OrderId = OrderId; orderItem.Item = Item; var orderItemDa = new OrderItemDa(databasecontext); //if new if (id < 1) orderItem = orderItemDa.Add(orderItem); //update else orderItem = orderItemDa.Update(orderItem); return orderItem; }