public async Task <ActionResult <TicketPriority_TicketPriorityDTO> > Create([FromBody] TicketPriority_TicketPriorityDTO TicketPriority_TicketPriorityDTO)
        {
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            if (!await HasPermission(TicketPriority_TicketPriorityDTO.Id))
            {
                return(Forbid());
            }

            TicketPriority TicketPriority = ConvertDTOToEntity(TicketPriority_TicketPriorityDTO);

            TicketPriority = await TicketPriorityService.Create(TicketPriority);

            TicketPriority_TicketPriorityDTO = new TicketPriority_TicketPriorityDTO(TicketPriority);
            if (TicketPriority.IsValidated)
            {
                return(TicketPriority_TicketPriorityDTO);
            }
            else
            {
                return(BadRequest(TicketPriority_TicketPriorityDTO));
            }
        }
        public async Task <ActionResult <TicketPriority_TicketPriorityDTO> > Get([FromBody] TicketPriority_TicketPriorityDTO TicketPriority_TicketPriorityDTO)
        {
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            if (!await HasPermission(TicketPriority_TicketPriorityDTO.Id))
            {
                return(Forbid());
            }

            TicketPriority TicketPriority = await TicketPriorityService.Get(TicketPriority_TicketPriorityDTO.Id);

            return(new TicketPriority_TicketPriorityDTO(TicketPriority));
        }
        private TicketPriority ConvertDTOToEntity(TicketPriority_TicketPriorityDTO TicketPriority_TicketPriorityDTO)
        {
            TicketPriority TicketPriority = new TicketPriority();

            TicketPriority.Id          = TicketPriority_TicketPriorityDTO.Id;
            TicketPriority.Name        = TicketPriority_TicketPriorityDTO.Name;
            TicketPriority.OrderNumber = TicketPriority_TicketPriorityDTO.OrderNumber;
            TicketPriority.ColorCode   = TicketPriority_TicketPriorityDTO.ColorCode;
            TicketPriority.StatusId    = TicketPriority_TicketPriorityDTO.StatusId;
            TicketPriority.Used        = TicketPriority_TicketPriorityDTO.Used;
            TicketPriority.Status      = TicketPriority_TicketPriorityDTO.Status == null ? null : new Status
            {
                Id   = TicketPriority_TicketPriorityDTO.Status.Id,
                Code = TicketPriority_TicketPriorityDTO.Status.Code,
                Name = TicketPriority_TicketPriorityDTO.Status.Name,
            };
            TicketPriority.BaseLanguage = CurrentContext.Language;
            return(TicketPriority);
        }