예제 #1
0
        public void DeleteTask(int id)
        {
            Thask taskToBeDeleted = (from t in _repo.Query <Thask>()
                                     where t.id == id
                                     select t).FirstOrDefault();

            _repo.Delete(taskToBeDeleted);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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());
            }
        }
예제 #4
0
        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);
        }