public virtual ApiAirTransportServerResponseModel MapEntityToModel( AirTransport item) { var model = new ApiAirTransportServerResponseModel(); model.SetProperties(item.Id, item.AirlineId, item.FlightNumber, item.HandlerId, item.LandDate, item.PipelineStepId, item.TakeoffDate); if (item.HandlerIdNavigation != null) { var handlerIdModel = new ApiHandlerServerResponseModel(); handlerIdModel.SetProperties( item.HandlerIdNavigation.Id, item.HandlerIdNavigation.CountryId, item.HandlerIdNavigation.Email, item.HandlerIdNavigation.FirstName, item.HandlerIdNavigation.LastName, item.HandlerIdNavigation.Phone); model.SetHandlerIdNavigation(handlerIdModel); } return(model); }
public virtual ApiAirTransportClientRequestModel MapServerResponseToClientRequest( ApiAirTransportServerResponseModel response) { var request = new ApiAirTransportClientRequestModel(); request.SetProperties( response.AirlineId, response.FlightNumber, response.HandlerId, response.LandDate, response.PipelineStepId, response.TakeoffDate); return(request); }
public virtual ApiAirTransportServerResponseModel MapServerRequestToResponse( int id, ApiAirTransportServerRequestModel request) { var response = new ApiAirTransportServerResponseModel(); response.SetProperties(id, request.AirlineId, request.FlightNumber, request.HandlerId, request.LandDate, request.PipelineStepId, request.TakeoffDate); return(response); }
public void MapEntityToModel() { var mapper = new DALAirTransportMapper(); AirTransport item = new AirTransport(); item.SetProperties(1, 1, "A", 1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1, DateTime.Parse("1/1/1987 12:00:00 AM")); ApiAirTransportServerResponseModel response = mapper.MapEntityToModel(item); response.AirlineId.Should().Be(1); response.FlightNumber.Should().Be("A"); response.HandlerId.Should().Be(1); response.Id.Should().Be(1); response.LandDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.PipelineStepId.Should().Be(1); response.TakeoffDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); }
public virtual async Task <UpdateResponse <ApiAirTransportServerResponseModel> > Update( int id, ApiAirTransportServerRequestModel model) { var validationResult = await this.AirTransportModelValidator.ValidateUpdateAsync(id, model); if (validationResult.IsValid) { AirTransport record = this.DalAirTransportMapper.MapModelToEntity(id, model); await this.AirTransportRepository.Update(record); record = await this.AirTransportRepository.Get(id); ApiAirTransportServerResponseModel apiModel = this.DalAirTransportMapper.MapEntityToModel(record); await this.mediator.Publish(new AirTransportUpdatedNotification(apiModel)); return(ValidationResponseFactory <ApiAirTransportServerResponseModel> .UpdateResponse(apiModel)); } else { return(ValidationResponseFactory <ApiAirTransportServerResponseModel> .UpdateResponse(validationResult)); } }
public AirTransportUpdatedNotification(ApiAirTransportServerResponseModel record) { this.Record = record; }