Ejemplo n.º 1
0
        public ActionResult EditNote(Note note)
        {
            note.publishTime = DateTime.Now;
            if (ModelState.IsValid)
            {
                db.Entry(note).State = EntityState.Modified;
                db.SaveChanges();

                TempData["Success"] = "You entity has been changed!";
                return RedirectToAction("Index");
            }

            return View(note);
        }
Ejemplo n.º 2
0
 public bool CreateReservation(Note item)
 {
     item.publishTime = DateTime.Now;
     if (item != null)
     {
         db.Notes.Add(item);
         db.SaveChanges();
         return true;
     }
     else
     {
         var resp = new HttpResponseMessage(HttpStatusCode.BadRequest)
         {
             Content = new StringContent(string.Format("Invalid input data")),
             ReasonPhrase = "Invalid input data"
         };
         throw new HttpResponseException(resp);
     }
 }
Ejemplo n.º 3
0
 public ActionResult PrivatePage(Note note)
 {
     note.publishTime = DateTime.Now;
     if (note.noteHeader != null && note.noteText != null)
     {
         db.Notes.Add(note);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(note);
 }