Beispiel #1
0
        /// <summary>
        /// Get the user profile based on the user id
        /// </summary>
        /// <param name="userId">user id</param>
        /// <returns>user profile</returns>
        public UserProfileModel GetUser(int userId)
        {
            var userProfile      = userReadRepository.GetUser(userId);
            var userProfileModel = userProfileMapper.EntityToModel(userProfile);

            return(userProfileModel);
        }
Beispiel #2
0
        /// <summary>
        /// get the details of a client based on the clientid
        /// </summary>
        /// <param name="clientId"></param>
        /// <returns>client full information</returns>
        public ClientDetailViewModel GetClientDetail(int clientId)
        {
            var clientDetail      = clientReadRepository.GetClientDetail(clientId);
            var clientDetailModel = clientMapper.EntityToModel(clientDetail);

            return(clientDetailModel);
        }
Beispiel #3
0
        /// <summary>
        /// Returns the own helpdesk tickets
        /// </summary>
        /// <param name="userId">user id - owner of the ticket</param>
        /// <returns>list of tickets</returns>
        public IEnumerable <TicketListViewModel> GetOwnHelpdeskList(int userId)
        {
            var tickets   = ticketReadRepository.GetOwnHelpdeskList(userId).ToList();
            var modelList = ticketListMapper.EntityToModel(tickets).ToList();

            modelList.ForEach(os =>
                              MapCustomFields(os, tickets.First(op => op.Id == os.Id)));
            return(modelList);
        }
Beispiel #4
0
        /// <summary>
        /// Get the team based on the team id
        /// </summary>
        /// <param name="teamId">team id</param>
        /// <returns>team list</returns>
        public IEnumerable <TeamModel> GetTeam(int teamId)
        {
            var team      = userReadRepository.GetTeam(teamId);
            var teamModel = teamMapper.EntityToModel(team);

            return(teamModel);
        }
Beispiel #5
0
        /// <summary>
        /// get the details of the ticket.
        /// </summary>
        /// <param name="ticketId">ticket id</param>
        /// <returns></returns>
        public TicketDetailViewModel GetTicket(int ticketId)
        {
            var ticket = ticketReadRepository.GetTicket(ticketId);

            if (ticket == null)
            {
                throw new NotFoundException("Helpdesk ticket is not found");
            }

            var ticketModel = ticketDetailMapper.EntityToModel(ticket);

            if (ticket.AssignedTechnicianId.HasValue)
            {
                ticketModel.AssigedTechnician = userReadManager.GetUser(ticket.AssignedTechnicianId.Value);
            }
            if (ticket.ClientId > 0)
            {
                ticketModel.Client = clientReadManager.GetClientDetail(ticket.ClientId);
            }
            return(ticketModel);
        }