예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            GasNote gasNote = db.GasNotes.Find(id);

            //db.GasNotes.Remove(gasNote);
            gasNote.Deleted = true;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 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));
 }
예제 #3
0
        // 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));
        }
예제 #4
0
        // 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));
        }
예제 #5
0
        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));
        }
예제 #6
0
        // 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));
        }