Пример #1
0
        public ActionResult Edit(string id)
        {
            IEnumerable <Species> model = new SpecciesF().accessDatabase;

            ViewBag.speciesID = new SelectList(model, "id", "Name", id);
            return(View());
        }
Пример #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());
        }
Пример #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());
        }
Пример #4
0
        public void setViewBag(long?id = null)
        {
            IEnumerable <Species> model = new SpecciesF().accessDatabase;

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