// GET: Producers/Delete/5
        public ActionResult Delete(int id)
        {
            var action = new CheckController().CheckStatus("Producers");

            if (action != null)
            {
                return(action);
            }
            if (id == db.GetUNProducer().ID)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Producer producer = db.Get(id);

            if (producer == null)
            {
                return(HttpNotFound());
            }
            var products = new MProducts().Get_All().Where(item =>
                                                           item.Producer_ID == id).ToList();

            foreach (var item in products)
            {
                item.Category = new MCategories().Get(item.Category_ID);
            }

            ViewBag.Products = products;
            return(View(producer));
        }
Esempio n. 2
0
        public ActionResult Index()
        {
            MProducts prod = new MProducts();

            prod.Products = _product.Get();
            return(View("Product-list", prod));
        }
Esempio n. 3
0
        public ActionResult Products()
        {
            MProducts prod = new MProducts();

            prod.Products = _product.Get();
            return(View(prod));
        }
Esempio n. 4
0
        // GET: Categories/Delete/5
        public ActionResult Delete(int id)
        {
            var action = new CheckController().CheckStatus("Categories");

            if (action != null)
            {
                return(action);
            }
            //if (id == null)
            //{
            //    return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            //}
            Category categorie = db.Get(id);

            if (categorie == null)
            {
                return(HttpNotFound());
            }
            var products = new MProducts().Get_All().Where(item =>
                                                           item.Category_ID == id).ToList();

            foreach (var item in products)
            {
                item.Producer = new MProducers().Get(item.Producer_ID);
            }

            ViewBag.Products = products;
            return(View(categorie));
        }