Esempio n. 1
0
        public ActionResult Edit(string id)
        {
            IEnumerable <Species> model = new SpecciesF().accessDatabase;

            ViewBag.speciesID = new SelectList(model, "id", "Name", id);
            return(View());
        }
Esempio n. 2
0
        public ActionResult Edit(Product model)
        {
            if (ModelState.IsValid)
            {
                ProductF productF = new ProductF();
                productF.Update(model);
                return(RedirectToAction("Index", "ProductAdmin"));
            }
            IEnumerable <Species> specieslist = new SpecciesF().accessDatabase;

            ViewBag.speciesID = new SelectList(specieslist, "id", "Name", model.id);
            return(View());
        }
Esempio n. 3
0
        public ActionResult Create(Product model)
        {
            ProductF productf = new ProductF();

            if (ModelState.IsValid)
            {
                productf.Insert(model);
                return(RedirectToAction("Index", "ProductAdmin"));
            }
            IEnumerable <Species> specieslist = new SpecciesF().accessDatabase;

            ViewBag.speciesID = new SelectList(specieslist, "id", "Name");
            return(View());
        }
Esempio n. 4
0
        public void setViewBag(long?id = null)
        {
            IEnumerable <Species> model = new SpecciesF().accessDatabase;

            ViewBag.Species = new SelectList(model, "id", "Name", id);
        }