public virtual ApiProvinceClientRequestModel MapServerResponseToClientRequest( ApiProvinceServerResponseModel response) { var request = new ApiProvinceClientRequestModel(); request.SetProperties( response.CountryId, response.Name); return(request); }
public virtual ApiProvinceServerResponseModel MapServerRequestToResponse( int id, ApiProvinceServerRequestModel request) { var response = new ApiProvinceServerResponseModel(); response.SetProperties(id, request.CountryId, request.Name); return(response); }
public void MapEntityToModel() { var mapper = new DALProvinceMapper(); Province item = new Province(); item.SetProperties(1, 1, "A"); ApiProvinceServerResponseModel response = mapper.MapEntityToModel(item); response.CountryId.Should().Be(1); response.Id.Should().Be(1); response.Name.Should().Be("A"); }
public virtual ApiVenueServerResponseModel MapEntityToModel( Venue item) { var model = new ApiVenueServerResponseModel(); model.SetProperties(item.Id, item.Address1, item.Address2, item.AdminId, item.Email, item.Facebook, item.Name, item.Phone, item.ProvinceId, item.Website); if (item.AdminIdNavigation != null) { var adminIdModel = new ApiAdminServerResponseModel(); adminIdModel.SetProperties( item.AdminIdNavigation.Id, item.AdminIdNavigation.Email, item.AdminIdNavigation.FirstName, item.AdminIdNavigation.LastName, item.AdminIdNavigation.Password, item.AdminIdNavigation.Phone, item.AdminIdNavigation.Username); model.SetAdminIdNavigation(adminIdModel); } if (item.ProvinceIdNavigation != null) { var provinceIdModel = new ApiProvinceServerResponseModel(); provinceIdModel.SetProperties( item.ProvinceIdNavigation.Id, item.ProvinceIdNavigation.CountryId, item.ProvinceIdNavigation.Name); model.SetProvinceIdNavigation(provinceIdModel); } return(model); }
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 ApiCityServerResponseModel MapEntityToModel( City item) { var model = new ApiCityServerResponseModel(); model.SetProperties(item.Id, item.Name, item.ProvinceId); if (item.ProvinceIdNavigation != null) { var provinceIdModel = new ApiProvinceServerResponseModel(); provinceIdModel.SetProperties( item.ProvinceIdNavigation.Id, item.ProvinceIdNavigation.CountryId, item.ProvinceIdNavigation.Name); model.SetProvinceIdNavigation(provinceIdModel); } return(model); }
public virtual async Task <UpdateResponse <ApiProvinceServerResponseModel> > Update( int id, ApiProvinceServerRequestModel model) { var validationResult = await this.ProvinceModelValidator.ValidateUpdateAsync(id, model); if (validationResult.IsValid) { Province record = this.DalProvinceMapper.MapModelToEntity(id, model); await this.ProvinceRepository.Update(record); record = await this.ProvinceRepository.Get(id); ApiProvinceServerResponseModel apiModel = this.DalProvinceMapper.MapEntityToModel(record); await this.mediator.Publish(new ProvinceUpdatedNotification(apiModel)); return(ValidationResponseFactory <ApiProvinceServerResponseModel> .UpdateResponse(apiModel)); } else { return(ValidationResponseFactory <ApiProvinceServerResponseModel> .UpdateResponse(validationResult)); } }
public void SetProvinceIdNavigation(ApiProvinceServerResponseModel value) { this.ProvinceIdNavigation = value; }
public ProvinceUpdatedNotification(ApiProvinceServerResponseModel record) { this.Record = record; }