Exemplo n.º 1
0
 public ActionResult Update(UserToDoListViewModel model)
 {
     try
     {
         var user = _UserToDoListService.GetUserToDoList(model.ID);
         if (user != null)
         {
             user.Title   = model.Title;
             user.DueDate = model.DueDate;
             _UserToDoListService.UpdateUserToDoList(user);
         }
         return(Json(new { data = "Edit", Success = true }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new { data = "Edit", Success = false }, JsonRequestBehavior.AllowGet));
     }
 }
Exemplo n.º 2
0
        public ActionResult Update(int id)
        {
            var user = _UserToDoListService.GetUserToDoList(id);

            if (user != null)
            {
                UserToDoListViewModel model = new UserToDoListViewModel
                {
                    ID      = id,
                    Title   = user.Title,
                    DueDate = user.DueDate
                };

                return(View(model));
            }
            else
            {
                return(RedirectToAction("List"));
            }
        }
Exemplo n.º 3
0
        public ActionResult Create(UserToDoListViewModel model)
        {
            try
            {
                var user = System.Web.HttpContext.Current.GetOwinContext().GetUserManager <ApplicationUserManager>().FindById(System.Web.HttpContext.Current.User.Identity.GetUserId());

                var UserToDoList = new UserToDoList
                {
                    Title   = model.Title,
                    DueDate = model.DueDate,
                    UserID  = user.Id
                };
                _UserToDoListService.AddUserToDoList(UserToDoList);

                //var idResult = um.Create(user, model.Password);
                return(Json(new { data = "Add", Success = true }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { data = "Add", Success = false }, JsonRequestBehavior.AllowGet));
            }
        }