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))); }
public ActionResult <HomeTaskDto> Get(int id) { var homeTask = _homeTaskService.GetHomeTaskById(id); if (homeTask == null) { return(NotFound()); } return(Ok(HomeTaskDto.FromModel(homeTask))); }
public ActionResult <HomeTaskDto> Post([FromBody] HomeTaskDto homeTask) { var createdHomeTask = _homeTaskService.CreateHomeTask(homeTask.ToModel()); return(Accepted(HomeTaskDto.FromModel(createdHomeTask))); }
public ActionResult <IEnumerable <HomeTaskDto> > Get() { return(Ok(_homeTaskService.GetAllHomeTasks().Select(homeTask => HomeTaskDto.FromModel(homeTask)))); }