Ejemplo n.º 1
0
 public IActionResult Update(int id, IdentityExample1.Models.Task task)
 {
     task.ID = id;
     Console.WriteLine("Task Desc: " + task.Description);
     Console.WriteLine("Task DueDate: " + task.DueDate.ToString("MM/dd/yyyy"));
     tasksDAL.UpdateTask(task);
     return(RedirectToAction("Index"));
 }
Ejemplo n.º 2
0
        public IActionResult AddTask(IdentityExample1.Models.Task task)
        {
            task.UserID = int.Parse(_userManager.GetUserId(User));

            tasksDAL.AddTask(task);

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
        public IActionResult Search(IdentityExample1.Models.Task task)
        {
            if (string.IsNullOrEmpty(task.Description))
            {
                return(RedirectToAction("Index"));
            }


            if (int.TryParse(_userManager.GetUserId(User), out int UserID))
            {
                string searchTerm = task.Description;
                ViewData["allTasks"] = tasksDAL.SearchTasksByUserID(UserID, searchTerm);
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }


            return(View("Index"));
        }