public ActionResult CreateTask(TaskDetails task) { if (string.IsNullOrEmpty(task.Title)) { ModelState.AddModelError(nameof(task.Title), "Title is required"); } if (ModelState.IsValid) { db.Add(task); TempData["Message"] = "You have successfully added your task"; return(RedirectToAction("Task", new { id = task.TaskId })); } return(View()); }
public Task AddTask(Task task) { return(_serviceTask.Add(task)); }
public ActionResult Post(TaskDTO model) { return(Ok(_task.Add(model))); }
public void Post(Task task) { _tasks.Add(task); }