public ActionResult Edit(string id) { IEnumerable <Species> model = new SpecciesF().accessDatabase; ViewBag.speciesID = new SelectList(model, "id", "Name", id); return(View()); }
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()); }
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()); }
public void setViewBag(long?id = null) { IEnumerable <Species> model = new SpecciesF().accessDatabase; ViewBag.Species = new SelectList(model, "id", "Name", id); }