public void DeleteTask(int id) { Thask taskToBeDeleted = (from t in _repo.Query <Thask>() where t.id == id select t).FirstOrDefault(); _repo.Delete(taskToBeDeleted); }
public void UpdateTask(Thask task) { Requirement requirement = (from r in _repo.Query <Requirement>() where r.Id == task.Story.Id select r).FirstOrDefault(); task.Story = requirement; _repo.Update(task); }
public IActionResult Post([FromBody] Thask task) { if (task == null) { return(BadRequest()); } else if (task.id == 0) { _tsk.AddTask(task); return(Ok()); } else { _tsk.UpdateTask(task); return(Ok()); } }
public Thask GetTask(int id) { Thask task = (from t in _repo.Query <Thask>() where t.id == id select new Thask { id = t.id, TaskName = t.TaskName, Description = t.Description, Story = (from r in _repo.Query <Requirement>() where r.Id == t.Story.Id select new Requirement { Id = r.Id, RequirementName = r.RequirementName }).FirstOrDefault() }).FirstOrDefault(); return(task); }