public Ticket DtoToModel(TicketDto dto) { if (dto == null) { return(null); } Ticket ticket = new Ticket { Id = dto.Id, OpenDateTime = DateTime.Parse(dto.OpenDateTime), CloseDateTime = string.IsNullOrEmpty(dto.CloseDateTime) ? (DateTime?)null : DateTime.Parse(dto.CloseDateTime), CustomerName = dto.CustomerName, Subject = dto.Subject, Description = dto.Description, User = _userRepository.GetByName(dto.UserName), Priority = _priorityRepository.GetByName(dto.PriorityName), ServiceType = _serviceTypeRepository.GetByName(dto.ServiceTypeName), Status = _statusRepository.GetByName(dto.StatusName), TicketType = _ticketTypeRepository.GetByName(dto.TicketTypeName) }; return(ticket); }
public ServiceTypeDto GetByName(string name) { return(MapperHelper <ServiceType, ServiceTypeDto> .ConvertToDto(_repository.GetByName(name))); }