public List <Core.Models.Task> Post([FromBody] Core.Models.Task task) { if (task.Id == null) { _service.Add(task); } else { _service.Edit(task); } return(_service.GetAll()); }
public ActionResult Edit(int id, IFormCollection collection) { try { var task = new Core.Models.Task { Description = collection["Name"].ToString(), Status = collection["Status"] == "true" }; _service.Edit(task); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }