public ActionResult <ProjectDto> CreateTimeEntry(TimeEntryCreateDto timeEntryCreateDto) { var timeEntry = _mapper.Map <TimeEntry>(timeEntryCreateDto); _repository.CreateTimeEntry(timeEntry); _repository.SaveChanges(); var timeEntryDto = _mapper.Map <TimeEntryDto>(timeEntry); return(Ok(timeEntryDto)); }
public ActionResult <ProjectDto> CreateProject(ProjectCreateDto projectCreateDto) { var project = _mapper.Map <Project>(projectCreateDto); _repository.CreateProject(project); _repository.SaveChanges(); var projectDto = _mapper.Map <ProjectDto>(project); //return URI to use for redirection after we create a project in react return(CreatedAtRoute(nameof(GetProject), new { id = projectDto.id }, projectDto)); //return Ok(projectDto); }