public string Create(Order order)
        {
            var product = ReduceProductStock(order.ProdcutCode, order.Quantity); //Reduce product stock as order quantity

            if (product == null)
            {
                return(null);
            }

            order.Price      = product.Price;
            order.TotalPrice = order.Price * order.Quantity;

            var result = _orderData.Create(order);

            if (result > 0)
            {
                var campaign = _campaignData.Get(x => x.ProductCode == order.ProdcutCode && x.Status == true);
                if (campaign != null)
                {
                    campaign.TotalSales += order.Quantity; //Add quantity to Campaign TotalSales
                    if (campaign.TargetSalesCount == campaign.TotalSales)
                    {
                        campaign.Status = false;
                    }
                    _campaignData.Update(campaign);
                }

                return(string.Format(" Order created; product {0}, quantity {1}", order.ProdcutCode, order.Quantity));
            }

            return(null);
        }
        public ActionResult Create(Order order)
        {
            try
            {
                order.StatusId = createdOrderStatusId;
                order.ToDo     = createdOrderToDO;

                orderDb.Create(order);

                return(RedirectToAction(ActionNameIndex));
            }
            catch
            {
                Order_Edit model = new Order_Edit(customerDb, employeeDb, statusDb, order);

                return(View(model));
            }
        }