public void CreateOrder(OrderViewModel orderModel, string username)
        {
            Order order = new Order();
            order.Price = orderModel.TotalPrice;
            List<Part> partList = new List<Part>();
            order.DeliveryDate = orderModel.DeliveryDate;

            var codeString = "";

            foreach (var item in orderModel.CategoryParts)
            {
                Part p = _productService.GetPartById(item.PartId);
                partList.Add(p);

                codeString += CodeBefore + p.Code + CodeAfter + CodeDevider;
            }
            codeString = codeString.Remove(codeString.LastIndexOf(CodeDevider));
            order.Code = codeString;
            _orderService.Save(order, partList, username);
        }
 public void SendOrder(Order order)
 {
     _context.Entry(order).State = EntityState.Modified;
     _context.SaveChanges();
 }