public async Task <ActionResult <List <TicketPriority_TicketPriorityDTO> > > List([FromBody] TicketPriority_TicketPriorityFilterDTO TicketPriority_TicketPriorityFilterDTO) { if (!ModelState.IsValid) { throw new BindException(ModelState); } TicketPriorityFilter TicketPriorityFilter = ConvertFilterDTOToFilterEntity(TicketPriority_TicketPriorityFilterDTO); TicketPriorityFilter = TicketPriorityService.ToFilter(TicketPriorityFilter); List <TicketPriority> TicketPriorities = await TicketPriorityService.List(TicketPriorityFilter); List <TicketPriority_TicketPriorityDTO> TicketPriority_TicketPriorityDTOs = TicketPriorities .Select(c => new TicketPriority_TicketPriorityDTO(c)).ToList(); return(TicketPriority_TicketPriorityDTOs); }
public async Task <ActionResult <TicketIssueLevel_TicketIssueLevelDTO> > GetDraft([FromBody] TicketIssueLevel_TicketIssueLevelDTO TicketIssueLevel_TicketIssueLevelDTO) { if (!ModelState.IsValid) { throw new BindException(ModelState); } TicketIssueLevel_TicketIssueLevelDTO TicketIssueLevel_TicketIssueLevelDTODraft = new TicketIssueLevel_TicketIssueLevelDTO(); List <TicketPriority> TicketPriorities = await TicketPriorityService.List(new TicketPriorityFilter { Skip = 0, Take = int.MaxValue, Selects = TicketPrioritySelect.ALL, }); TicketIssueLevel_TicketIssueLevelDTODraft.SLAPolicies = TicketPriorities.Select(x => new TicketIssueLevel_SLAPolicyDTO { TicketPriorityId = x.Id, TicketPriority = new TicketIssueLevel_TicketPriorityDTO(x), IsAlert = false, IsAlertFRT = false, IsEscalation = false, IsEscalationFRT = false, FirstResponseTime = 0, ResolveTime = 0, ResolveUnit = new TicketIssueLevel_SLATimeUnitDTO { Id = SLATimeUnitEnum.HOURS.Id, Code = SLATimeUnitEnum.HOURS.Code, Name = SLATimeUnitEnum.HOURS.Name }, FirstResponseUnit = new TicketIssueLevel_SLATimeUnitDTO { Id = SLATimeUnitEnum.MINUTES.Id, Code = SLATimeUnitEnum.MINUTES.Code, Name = SLATimeUnitEnum.MINUTES.Name }, FirstResponseUnitId = SLATimeUnitEnum.MINUTES.Id, ResolveUnitId = SLATimeUnitEnum.HOURS.Id }).ToList(); TicketIssueLevel_TicketIssueLevelDTODraft.Status = new TicketIssueLevel_StatusDTO { Code = Enums.StatusEnum.ACTIVE.Code, Id = Enums.StatusEnum.ACTIVE.Id, Name = Enums.StatusEnum.ACTIVE.Name }; TicketIssueLevel_TicketIssueLevelDTODraft.StatusId = Enums.StatusEnum.ACTIVE.Id; TicketIssueLevel_TicketIssueLevelDTODraft.SLAAlerts = new List <TicketIssueLevel_SLAAlertDTO>(); TicketIssueLevel_TicketIssueLevelDTODraft.SLAAlerts.Add(new TicketIssueLevel_SLAAlertDTO { IsNotification = true, Time = 15, IsAssignedToUser = true, TimeUnitId = SLATimeUnitEnum.MINUTES.Id, TimeUnit = new TicketIssueLevel_SLATimeUnitDTO { Id = SLATimeUnitEnum.MINUTES.Id, Code = SLATimeUnitEnum.MINUTES.Code, Name = SLATimeUnitEnum.MINUTES.Name }, }); TicketIssueLevel_TicketIssueLevelDTODraft.SLAAlertFRTs = new List <TicketIssueLevel_SLAAlertFRTDTO>(); TicketIssueLevel_TicketIssueLevelDTODraft.SLAAlertFRTs.Add(new TicketIssueLevel_SLAAlertFRTDTO { IsNotification = true, Time = 15, IsAssignedToUser = true, TimeUnitId = SLATimeUnitEnum.MINUTES.Id, TimeUnit = new TicketIssueLevel_SLATimeUnitDTO { Id = SLATimeUnitEnum.MINUTES.Id, Code = SLATimeUnitEnum.MINUTES.Code, Name = SLATimeUnitEnum.MINUTES.Name }, }); TicketIssueLevel_TicketIssueLevelDTODraft.SLAEscalations = new List <TicketIssueLevel_SLAEscalationDTO>(); TicketIssueLevel_TicketIssueLevelDTODraft.SLAEscalations.Add(new TicketIssueLevel_SLAEscalationDTO { IsNotification = true, Time = 15, IsAssignedToUser = true, TimeUnitId = SLATimeUnitEnum.MINUTES.Id, TimeUnit = new TicketIssueLevel_SLATimeUnitDTO { Id = SLATimeUnitEnum.MINUTES.Id, Code = SLATimeUnitEnum.MINUTES.Code, Name = SLATimeUnitEnum.MINUTES.Name }, }); TicketIssueLevel_TicketIssueLevelDTODraft.SLAEscalationFRTs = new List <TicketIssueLevel_SLAEscalationFRTDTO>(); TicketIssueLevel_TicketIssueLevelDTODraft.SLAEscalationFRTs.Add(new TicketIssueLevel_SLAEscalationFRTDTO { IsNotification = true, Time = 15, IsAssignedToUser = true, TimeUnitId = SLATimeUnitEnum.MINUTES.Id, TimeUnit = new TicketIssueLevel_SLATimeUnitDTO { Id = SLATimeUnitEnum.MINUTES.Id, Code = SLATimeUnitEnum.MINUTES.Code, Name = SLATimeUnitEnum.MINUTES.Name }, }); return(TicketIssueLevel_TicketIssueLevelDTODraft); }