public InformationDto AddInfomation(InformationDto dto) { Information information = _modelMapper.FromInformationDto(dto); Information created = _informationRepository.Add(information); InformationDto createdInformationDto = _modelMapper.ToInformationDto(created); return(createdInformationDto); }
public async void OnNext(InformationEvent value) { Console.WriteLine("Cyclic message:", value); InformationDto code = mapper.ToInformationDto(value.Information); string body = JsonConvert.SerializeObject(code); Message message = new Message() { Action = EndpointAction.PUBLISH_INFORMATION.GetString(), Type = "DailyInfoDto", Body = body }; Console.WriteLine($"Daily information: {message}"); await _connection.SendAsync(JsonConvert.SerializeObject(message)); }
public void ToInformationDto_MapInformationFromModelToDto() { Guid id = new Guid("0f8fad5b-d9cb-469f-a165-70867728950e"); string content = "Content test"; bool isDeleted = false; Information information = new Information() { Id = id, IsDeleted = isDeleted, Content = content }; DtoModelMapper mapper = new DtoModelMapper(); InformationDto informationDto = mapper.ToInformationDto(information); Assert.AreEqual(id, informationDto.Id, "Copied 'Id' has invalid value"); Assert.AreEqual(content, informationDto.Content, "Copied 'content' has invalid value"); Assert.AreEqual(isDeleted, informationDto.IsDeleted, "Copied 'is deleted' has invalid value"); }