public IActionResult UpdateTask(ToDo td) { if (ModelState.IsValid) { _db.Update(td); _db.SaveChanges(); } return(RedirectToAction("TaskList")); }
public IActionResult UpdateTask(int Id) { Tasks found = _context.Tasks.Find(Id); if (ModelState.IsValid && found != null) { found.Complete = "Yes"; _context.Entry(found).State = Microsoft.EntityFrameworkCore.EntityState.Modified; _context.Update(found); _context.SaveChanges(); } return(RedirectToAction("ListTasks")); }
public IActionResult CompleteTask(int id) { Tasks found = _context.Tasks.Find(id); if (found != null) { found.Complete = !found.Complete; _context.Entry(found).State = Microsoft.EntityFrameworkCore.EntityState.Modified; _context.Update(found); _context.SaveChanges(); } return(RedirectToAction("TasksIndex")); }
public IActionResult ToggleStatus(int id) { Tasks targetTask = _context.Tasks.Find(id); if (targetTask != null) { targetTask.Complete = !targetTask.Complete; _context.Entry(targetTask).State = Microsoft.EntityFrameworkCore.EntityState.Modified; _context.Update(targetTask); _context.SaveChanges(); } return(RedirectToAction("TaskIndex")); }
public IActionResult ChangeStatus(int id) { Tasks found = _context.Tasks.Find(id); if (found != null) { //Change the things! found.Complete = !found.Complete; //modify the state of this entry in the database _context.Entry(found).State = Microsoft.EntityFrameworkCore.EntityState.Modified; _context.Update(found); _context.SaveChanges(); } return(RedirectToAction("Index")); }
public IActionResult UpdateTask(Tasks newTask) { Tasks oldTask = _context.Tasks.Find(newTask.Id); if (ModelState.IsValid) { oldTask.Description = newTask.Description; oldTask.DueDate = newTask.DueDate; oldTask.Completion = newTask.Completion; _context.Entry(oldTask).State = Microsoft.EntityFrameworkCore.EntityState.Modified; _context.Update(oldTask); _context.SaveChanges(); } return(RedirectToAction("TaskIndex")); }
public IActionResult Update(TaskList taskId) { TaskList found = _context.TaskList.Find(taskId.UserId); if (ModelState.IsValid && found != null) { found.Complete = "yes"; _context.Entry(found).State = Microsoft.EntityFrameworkCore.EntityState.Modified; _context.Update(found); _context.SaveChanges(); } return(RedirectToAction("TaskList")); }
public IActionResult UpdateTask(int TaskId) { Tasks findTask = _taskContext.Tasks.Find(TaskId); if (findTask.Complete) { findTask.Complete = false; } else { findTask.Complete = true; } _taskContext.Entry(findTask).State = Microsoft.EntityFrameworkCore.EntityState.Modified; _taskContext.Update(findTask); _taskContext.SaveChanges(); return(RedirectToAction("ListTasks")); }
public IActionResult UpdateComplete(int id) { Tasks found = _context.Tasks.Find(id); if (found != null) { if (found.Completed == "false") { found.Completed = "true"; } else { found.Completed = "false"; } _context.Entry(found).State = Microsoft.EntityFrameworkCore.EntityState.Modified; _context.Update(found); _context.SaveChanges(); } return(RedirectToAction("TaskIndex")); }
public IActionResult EditTask(Tasks t) { _context.Update(t); _context.SaveChanges(); return(RedirectToAction("TaskList")); }