public IActionResult OnPost() { Task = _taskData.Update(Task); _taskData.Commit(); return(Page()); }
public IActionResult OnPost(int taskId) { var task = _taskData.Delete(taskId); _taskData.Commit(); if (task == null) { return(RedirectToPage("./NotFound")); } TempData["Message"] = $"Task '{task.Title}' deleted!"; return(RedirectToPage("./List")); }
public IActionResult OnPost() { if (!ModelState.IsValid) { Status = _htmlHelper.GetEnumSelectList <TaskStatus>(); Priority = _htmlHelper.GetEnumSelectList <TaskPriority>(); return(Page()); } if (Task.Id > 0) { _taskData.Update(Task); TempData["Message"] = "Task updated!"; } else { _taskData.Add(Task); TempData["Message"] = "Task added!"; } _taskData.Commit(); return(RedirectToPage("./Detail", new { taskId = Task.Id })); }