private void FillProductsList(String id = "")
        {
            var list = pdb.Get_All();

            Products = new List <ProductToOrder>();
            foreach (var item in list)
            {
                item.Category = new MCategories().Get(item.Category_ID);
                item.Producer = new MProducers().Get(item.Producer_ID);
                Products.Add(new ProductToOrder(item));
            }
            if (!String.IsNullOrEmpty(id))
            {
                foreach (var item in db.GetOrders_Info(id))
                {
                    var oi = Products.Where(i => i.ID.CompareTo(item.Product_ID) == 0).FirstOrDefault();
                    if (oi != null)
                    {
                        oi.OrderQuantity = item.Quantity;
                        oi.PurchasePrice = item.Price;
                    }
                    else
                    {
                        var up = new MProducers().GetUNProducer().ID;
                        var uc = new MCategories().GetUNCategory().ID;

                        Product product = new Product()
                        {
                            ID           = item.Product_ID,
                            Picture      = "",
                            Product_Name = "",
                            Quantity     = 0,
                            Price        = 0,
                            Category_ID  = up,
                            Producer_ID  = uc
                        };
                        pdb.Add(product);
                        Products.Add(new ProductToOrder(product, item.Price, item.Quantity));
                    }
                }
            }
        }
        public ActionResult Create([Bind(Include = "ID,Product_Name,Producer_ID,Price,Category_ID")] Product product, HttpPostedFileBase ImageUrl)
        {
            var action = new CheckController().CheckStatus("Products");

            if (action != null)
            {
                return(action);
            }
            try
            {
                if (ModelState.IsValid)
                {
                    if (String.IsNullOrEmpty(product.ID) ||
                        String.IsNullOrWhiteSpace(product.ID))
                    {
                        throw new Exception($"Cannot Create Product By Empty ID");
                    }

                    if (ImageUrl != null)
                    {
                        var    str       = "";
                        string ImageName = Path.GetFileName(ImageUrl.FileName);
                        do
                        {
                            str = GetName();
                        } while (System.IO.File.Exists($"~/Content/Images/Products/{str}{ImageName}"));
                        string physicalPath = Server.MapPath($"~/Content/Images/Products/{str}{ImageName}");
                        ImageUrl.SaveAs(physicalPath);
                        product.Picture = $"{str}{ImageName}";
                    }
                    db.Add(product);
                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
            }
            ViewBag.Category_ID = new SelectList(MC.Get_All().Where(i => i.Name.CompareTo("Unknown") != 0).ToList(),
                                                 "ID", "Name", product.Category_ID);
            ViewBag.Producer_ID = new SelectList(MP.Get_All().Where(i => i.Name.CompareTo("Unknown") != 0).ToList(),
                                                 "ID", "Name", product.Producer_ID);
            return(View(product));
        }