Esempio n. 1
0
        public ActionResult <HomeTaskDto> Post([FromBody] HomeTaskDto homeTask)
        {
            var result = _homeTaskService.CreateHomeTask(homeTask.ToModel());

            if (result.HasErrors)
            {
                return(BadRequest(result.Errors));
            }
            return(Accepted(HomeTaskDto.FromModel(result.Result)));
        }
Esempio n. 2
0
        public ActionResult <HomeTaskDto> Get(int id)
        {
            var homeTask = _homeTaskService.GetHomeTaskById(id);

            if (homeTask == null)
            {
                return(NotFound());
            }

            return(Ok(HomeTaskDto.FromModel(homeTask)));
        }
Esempio n. 3
0
        public ActionResult <HomeTaskDto> Post([FromBody] HomeTaskDto homeTask)
        {
            var createdHomeTask = _homeTaskService.CreateHomeTask(homeTask.ToModel());

            return(Accepted(HomeTaskDto.FromModel(createdHomeTask)));
        }
Esempio n. 4
0
 public ActionResult <IEnumerable <HomeTaskDto> > Get()
 {
     return(Ok(_homeTaskService.GetAllHomeTasks().Select(homeTask => HomeTaskDto.FromModel(homeTask))));
 }