public ActionResult DeleteConfirmed(int id) { Brand_Model brand_Model = db.Brand_Model.Find(id); db.Brand_Model.Remove(brand_Model); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "id,model_id,brand_id")] Brand_Model brand_Model) { if (ModelState.IsValid) { db.Entry(brand_Model).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.brand_id = new SelectList(db.Brand, "id", "brandName", brand_Model.brand_id); ViewBag.model_id = new SelectList(db.Model, "id", "modelName", brand_Model.model_id); return(View(brand_Model)); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Brand_Model brand_Model = db.Brand_Model.Find(id); if (brand_Model == null) { return(HttpNotFound()); } return(View(brand_Model)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Brand_Model brand_Model = db.Brand_Model.Find(id); if (brand_Model == null) { return(HttpNotFound()); } ViewBag.brand_id = new SelectList(db.Brand, "id", "brandName", brand_Model.brand_id); ViewBag.model_id = new SelectList(db.Model, "id", "modelName", brand_Model.model_id); return(View(brand_Model)); }