예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Trace.WriteLine("POST /Notes/Delete/" + id);
            InfraNote note = db.notes.Find(id);

            db.notes.Remove(note);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "id, Name, Description,CreatedDate")] InfraNote note)
 {
     Trace.WriteLine("POST /Notes/Edit/" + note.ID);
     if (ModelState.IsValid)
     {
         db.Entry(note).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(note));
 }
예제 #3
0
        public ActionResult Create([Bind(Include = "Name, Description,CreatedDate")] InfraNote note)
        {
            Trace.WriteLine("POST /Notes/Create");
            if (ModelState.IsValid)
            {
                db.notes.Add(note);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(note));
        }
예제 #4
0
        // GET: Notes/Edit/5
        public ActionResult Edit(int?id)
        {
            Trace.WriteLine("GET /Notes/Edit/" + id);
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            InfraNote note = db.notes.Find(id);

            if (note == null)
            {
                return(HttpNotFound());
            }
            return(View(note));
        }