public virtual ApiUserServerResponseModel MapEntityToModel( User item) { var model = new ApiUserServerResponseModel(); model.SetProperties(item.UserId, item.BioImgUrl, item.Birthday, item.ContentDescription, item.Email, item.FullName, item.HeaderImgUrl, item.Interest, item.LocationLocationId, item.Password, item.PhoneNumber, item.Privacy, item.Username, item.Website); if (item.LocationLocationIdNavigation != null) { var locationLocationIdModel = new ApiLocationServerResponseModel(); locationLocationIdModel.SetProperties( item.LocationLocationIdNavigation.LocationId, item.LocationLocationIdNavigation.GpsLat, item.LocationLocationIdNavigation.GpsLong, item.LocationLocationIdNavigation.LocationName); model.SetLocationLocationIdNavigation(locationLocationIdModel); } return(model); }
public virtual ApiLocationClientRequestModel MapServerResponseToClientRequest( ApiLocationServerResponseModel response) { var request = new ApiLocationClientRequestModel(); request.SetProperties( response.GpsLat, response.GpsLong, response.LocationName); return(request); }
public virtual ApiLocationServerResponseModel MapServerRequestToResponse( int locationId, ApiLocationServerRequestModel request) { var response = new ApiLocationServerResponseModel(); response.SetProperties(locationId, request.GpsLat, request.GpsLong, request.LocationName); return(response); }
public virtual ApiLocationServerResponseModel MapEntityToModel( Location item) { var model = new ApiLocationServerResponseModel(); model.SetProperties(item.LocationId, item.GpsLat, item.GpsLong, item.LocationName); return(model); }
public void MapEntityToModel() { var mapper = new DALLocationMapper(); Location item = new Location(); item.SetProperties(1, 1, 1, "A"); ApiLocationServerResponseModel response = mapper.MapEntityToModel(item); response.GpsLat.Should().Be(1); response.GpsLong.Should().Be(1); response.LocationId.Should().Be(1); response.LocationName.Should().Be("A"); }
public virtual async Task <UpdateResponse <ApiLocationServerResponseModel> > Update( int locationId, ApiLocationServerRequestModel model) { var validationResult = await this.LocationModelValidator.ValidateUpdateAsync(locationId, model); if (validationResult.IsValid) { Location record = this.DalLocationMapper.MapModelToEntity(locationId, model); await this.LocationRepository.Update(record); record = await this.LocationRepository.Get(locationId); ApiLocationServerResponseModel apiModel = this.DalLocationMapper.MapEntityToModel(record); await this.mediator.Publish(new LocationUpdatedNotification(apiModel)); return(ValidationResponseFactory <ApiLocationServerResponseModel> .UpdateResponse(apiModel)); } else { return(ValidationResponseFactory <ApiLocationServerResponseModel> .UpdateResponse(validationResult)); } }
public void SetLocationIdNavigation(ApiLocationServerResponseModel value) { this.LocationIdNavigation = value; }
public LocationUpdatedNotification(ApiLocationServerResponseModel record) { this.Record = record; }