public virtual ApiCountryServerRequestModel MapServerResponseToRequest( ApiCountryServerResponseModel response) { var request = new ApiCountryServerRequestModel(); request.SetProperties( response.Name); return(request); }
public virtual ApiCountryServerResponseModel MapEntityToModel( Country item) { var model = new ApiCountryServerResponseModel(); model.SetProperties(item.Id, item.Name); return(model); }
public virtual ApiCountryServerResponseModel MapServerRequestToResponse( int id, ApiCountryServerRequestModel request) { var response = new ApiCountryServerResponseModel(); response.SetProperties(id, request.Name); return(response); }
public void MapEntityToModel() { var mapper = new DALCountryMapper(); Country item = new Country(); item.SetProperties(1, "A"); ApiCountryServerResponseModel response = mapper.MapEntityToModel(item); response.Id.Should().Be(1); response.Name.Should().Be("A"); }
public virtual ApiProvinceServerResponseModel MapEntityToModel( Province item) { var model = new ApiProvinceServerResponseModel(); model.SetProperties(item.Id, item.CountryId, item.Name); if (item.CountryIdNavigation != null) { var countryIdModel = new ApiCountryServerResponseModel(); countryIdModel.SetProperties( item.CountryIdNavigation.Id, item.CountryIdNavigation.Name); model.SetCountryIdNavigation(countryIdModel); } return(model); }
public virtual async Task <UpdateResponse <ApiCountryServerResponseModel> > Update( int id, ApiCountryServerRequestModel model) { var validationResult = await this.CountryModelValidator.ValidateUpdateAsync(id, model); if (validationResult.IsValid) { Country record = this.DalCountryMapper.MapModelToEntity(id, model); await this.CountryRepository.Update(record); record = await this.CountryRepository.Get(id); ApiCountryServerResponseModel apiModel = this.DalCountryMapper.MapEntityToModel(record); await this.mediator.Publish(new CountryUpdatedNotification(apiModel)); return(ValidationResponseFactory <ApiCountryServerResponseModel> .UpdateResponse(apiModel)); } else { return(ValidationResponseFactory <ApiCountryServerResponseModel> .UpdateResponse(validationResult)); } }
public void SetCountryIdNavigation(ApiCountryServerResponseModel value) { this.CountryIdNavigation = value; }
public CountryUpdatedNotification(ApiCountryServerResponseModel record) { this.Record = record; }