public void CreateOrder(DTOs.Order order) { usersWebService.Order ord = new usersWebService.Order(); ord.Id = (int)order.Id; ord.AccountName = order.AccountName; ord.CarndNumber = order.AccountName; ord.ProductId = order.ProductId; ord.Quantity = order.Quantity; ord.ProductName = order.ProductName; ord.ProductEan = order.ProductEan; ord.TotalPrice = order.TotalPrice; context.Order.Add(ord); }
public void UpdateOrder(DTOs.Order order, int orderid) { DTOs.Order orde = GetById(orderid); usersWebService.Order ord = new usersWebService.Order(); ord.Id = (int)orde.Id; context.Order.Remove(ord); ord.Id = (int)order.Id; ord.AccountName = order.AccountName; ord.CarndNumber = order.AccountName; ord.ProductId = order.ProductId; ord.Quantity = order.Quantity; ord.ProductName = order.ProductName; ord.ProductEan = order.ProductEan; ord.TotalPrice = order.TotalPrice; context.Order.Add(ord); // context.Entry(order).State = EntityState.Modified; Save(); }