public ActionResult DeleteConfirmed(int id) { GasNote gasNote = db.GasNotes.Find(id); //db.GasNotes.Remove(gasNote); gasNote.Deleted = true; db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "NotesID,Note,AutoID,CreatedOn,UpdatedOn,IPAddress,Broswer,Deleted,NoteDate")] GasNote gasNote) { if (ModelState.IsValid) { db.Entry(gasNote).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.NotesID = new SelectList(db.Autos, "ID", "AutoName", gasNote.NotesID); ViewBag.AutoID = new SelectList(db.Autos, "ID", "AutoName", gasNote.AutoID); return(View(gasNote)); }
// GET: Gas/GasNotes/Create public ActionResult Create(int id) { //ViewBag.NotesID = new SelectList(db.Autos, "ID", "AutoName"); ViewBag.AutoID = new SelectList(db.Autos, "ID", "AutoName"); GasNote gn = new GasNote(); if (id != null) { gn.AutoID = id; } return(View(gn)); }
// GET: Gas/GasNotes/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } GasNote gasNote = db.GasNotes.Find(id); if (gasNote == null) { return(HttpNotFound()); } return(View(gasNote)); }
public ActionResult Create([Bind(Include = "Note,AutoID,CreatedOn,UpdatedOn,IPAddress,Broswer,Deleted,NoteDate")] GasNote gasNote) { if (ModelState.IsValid) { gasNote.CreatedOn = DateTime.Now; //gasNote.NotesID = db.GasNotes.Count() + 1; //I should not have to do this... by why do i have too.... again!!!!!!! db.GasNotes.Add(gasNote); db.SaveChanges(); return(RedirectToAction("Index")); } //ViewBag.NotesID = new SelectList(db.Autos, "ID", "AutoName", gasNote.NotesID); ViewBag.AutoID = new SelectList(db.Autos, "ID", "AutoName", gasNote.AutoID); return(View(gasNote)); }
// GET: Gas/GasNotes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } GasNote gasNote = db.GasNotes.Find(id); if (gasNote == null) { return(HttpNotFound()); } ViewBag.NotesID = new SelectList(db.Autos, "ID", "AutoName", gasNote.NotesID); ViewBag.AutoID = new SelectList(db.Autos, "ID", "AutoName", gasNote.AutoID); return(View(gasNote)); }