public IActionResult getByTicketId(Guid id) { var res = new FindAllResponse <TicketHistoryDTO>(); res.Success = true; res.FoundEntitiesDTO = _mapper .Map <ICollection <TicketHistory>, ICollection <TicketHistoryDTO> >(_ticketHistoryRepository.FindHistoryForTicket(id)); return(Ok(res)); }
public FindAllResponse <UserDTO> FindAll() { var res = new FindAllResponse <UserDTO>(); var users = _userRepository.FindAll(); res.FoundEntitiesDTO = _mapper.Map <IEnumerable <User>, ICollection <UserDTO> >(users); res.Success = true; return(res); }
public FindAllResponse <TicketForProjectDTO> GetAllForProject(Guid projectId) { var res = new FindAllResponse <TicketForProjectDTO>(); res.FoundEntitiesDTO = _mapper.Map <ICollection <Ticket>, ICollection <TicketForProjectDTO> >(_ticketRepository.FindForProject(projectId)); res.Success = true; return(res); }
public FindAllResponse <TicketStatusDTO> GetAll() { var res = new FindAllResponse <TicketStatusDTO>(); var ticketStatuses = _ticketStatusRepository.FindAll(); res.FoundEntitiesDTO = _mapper.Map <ICollection <TicketStatus>, ICollection <TicketStatusDTO> >(ticketStatuses.ToList()); res.Success = true; return(res); }
public FindAllResponse <RoleDTO> FindAll() { var res = new FindAllResponse <RoleDTO>(); var roles = _roleRepository.FindAll().ToList(); var rolesDTO = _mapper.Map <ICollection <Role>, ICollection <RoleDTO> >(roles); res.Success = true; res.FoundEntitiesDTO = rolesDTO; return(res); }
public FindAllResponse <ProjectUserRequestDTO> GetAllSentReq(Guid id) { var res = new FindAllResponse <ProjectUserRequestDTO>(); var requests = _projectUserReqRepository.FindSentReqFor(id); res.FoundEntitiesDTO = _mapper.Map <ICollection <ProjectUserReq>, ICollection <ProjectUserRequestDTO> >(requests); res.Success = true; return(res); }
public FindAllResponse <T> FindAll() { var entities = _repository.FindAll(); var res = new FindAllResponse <T> { Errors = new List <string>(), Success = true, //need to map entity to dto! //FoundEntitiesDTO = entities.ToList().AsReadOnly() }; return(res); }
public FindAllResponse <ProjectAbbreviatedDTO> FindAll(Guid id) { var res = new FindAllResponse <ProjectAbbreviatedDTO>(); var projectsQuery = _projectRepository.GetBasicQuery(); projectsQuery = projectsQuery.Where( p => p.ProjectUsersReq.Where(pur => pur.UserAssigned.Id.Equals(id) || pur.Sender.Id.Equals(id)).ToList().Count > 0 ); res.FoundEntitiesDTO = _mapper.Map <ICollection <Project>, ICollection <ProjectAbbreviatedDTO> >(projectsQuery.ToList()); res.Success = true; return(res); }
public IActionResult FindForTicket(Guid id) { var res = new FindAllResponse <CommentDTO>(); var ticket = _ticketRepository.FindById(id); if (ticket is null) { res.Success = false; res.Errors.Add("Wrong ticket id!"); return(NotFound(res)); } res.Success = true; res.FoundEntitiesDTO = _mapper.Map <ICollection <Comment>, ICollection <CommentDTO> >(_commentRepository.findCommentsForTicket(id)); return(Ok(res)); }