Ejemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            TODOContainer tODOContainer = db.ToDoBase.Find(id);

            db.ToDoBase.Remove(tODOContainer);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "ID,Title,Group,Tag,RemindDate,IsDone")] TODOContainer tODOContainer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tODOContainer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tODOContainer));
 }
Ejemplo n.º 3
0
        // GET: TODOContainers/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TODOContainer tODOContainer = db.ToDoBase.Find(id);

            if (tODOContainer == null)
            {
                return(HttpNotFound());
            }
            return(View(tODOContainer));
        }
Ejemplo n.º 4
0
        public ActionResult Create([Bind(Include = "ID,Title,Group,Tag,RemindDate,IsDone")] TODOContainer tODOContainer)
        {
            if (ModelState.IsValid)
            {
                string          IDcurrentUser = User.Identity.GetUserId();
                ApplicationUser currentUser   = db.Users.FirstOrDefault(us => us.Id == IDcurrentUser);

                tODOContainer.User = currentUser;

                db.ToDoBase.Add(tODOContainer);
                db.SaveChanges();

                SendEmail(tODOContainer.User.UserName, tODOContainer.Title, tODOContainer.Tag, tODOContainer.Group, tODOContainer.RemindDate);

                return(RedirectToAction("Index"));
            }

            return(View(tODOContainer));
        }