public async Task <List <ProjectStatusDto> > GetAllProjectStatuses() { using (var scope = _dbContextScopeFactory.CreateReadOnly()) { var taskItemStatuses = await _projectStatusRepository.GetAsync(e => e.IsActive == true); return(_mapper.Map <List <ProjectStatusDto> >(taskItemStatuses)); } }
public async Task <IActionResult> Get(int id) { var ProjectStatusModel = new ProjectStatusModel(); try { var projectStatus = await _projectStatusRepository.GetAsync(id).ConfigureAwait(false); if (projectStatus == null) { return(NotFound()); } ProjectStatusModel.Id = projectStatus.Id; ProjectStatusModel.Title = projectStatus.Title; } catch (Exception ex) { return(BadRequest(ex.Message)); } return(Ok(ProjectStatusModel)); }