public ActionResult Edit([Bind(Include = "Id,Name,Description")] Category category) { if (ModelState.IsValid) { db.Entry(category).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(category)); }
public ActionResult Edit([Bind(Include = "Id,Name,CategoryId")] Concept concept) { if (ModelState.IsValid) { db.Entry(concept).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryId = new SelectList(db.Categories, "Id", "Name", concept.CategoryId); return(View(concept)); }
public ActionResult Edit([Bind(Include = "Id,ComponentName,ConceptId,SubConceptId,Required")] Component component) { if (ModelState.IsValid) { db.Entry(component).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ConceptId = new SelectList(db.Concepts, "Id", "Name", component.ConceptId); ViewBag.SubConceptId = new SelectList(db.Concepts, "Id", "Name", component.SubConceptId); return(View(component)); }
public ActionResult Edit([Bind(Include = "Id,BaseInstanceId,ComponentId,SubInstanceId,NumberOfIngredients")] Ingredient ingredient) { if (ModelState.IsValid) { db.Entry(ingredient).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BaseInstanceId = new SelectList(db.Instances, "Id", "Name", ingredient.BaseInstanceId); ViewBag.ComponentId = new SelectList(db.Components, "Id", "Id", ingredient.ComponentId); ViewBag.SubInstanceId = new SelectList(db.Instances, "Id", "Name", ingredient.SubInstanceId); return(View(ingredient)); }
public ActionResult Edit([Bind(Include = "Id,ConceptId,Name,Description")] Instance instance) { if (ModelState.IsValid) { UpdateModel(instance); HttpPostedFileBase file = Request.Files["plikZObrazkiem"]; if (file != null && file.ContentLength > 0) { instance.Obrazek = file.FileName; file.SaveAs(HttpContext.Server.MapPath("~/Obrazki/") + instance.Obrazek); } db.Entry(instance).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ConceptId = new SelectList(db.Concepts, "Id", "Name", instance.ConceptId); return(View(instance)); }