public virtual ApiPaymentTypeClientRequestModel MapServerResponseToClientRequest( ApiPaymentTypeServerResponseModel response) { var request = new ApiPaymentTypeClientRequestModel(); request.SetProperties( response.Name); return(request); }
public virtual ApiPaymentTypeServerResponseModel MapEntityToModel( PaymentType item) { var model = new ApiPaymentTypeServerResponseModel(); model.SetProperties(item.Id, item.Name); return(model); }
public virtual ApiPaymentTypeServerResponseModel MapServerRequestToResponse( int id, ApiPaymentTypeServerRequestModel request) { var response = new ApiPaymentTypeServerResponseModel(); response.SetProperties(id, request.Name); return(response); }
public void MapEntityToModel() { var mapper = new DALPaymentTypeMapper(); PaymentType item = new PaymentType(); item.SetProperties(1, "A"); ApiPaymentTypeServerResponseModel response = mapper.MapEntityToModel(item); response.Id.Should().Be(1); response.Name.Should().Be("A"); }
public virtual ApiSaleServerResponseModel MapEntityToModel( Sale item) { var model = new ApiSaleServerResponseModel(); model.SetProperties(item.Id, item.Amount, item.FirstName, item.LastName, item.PaymentTypeId, item.PetId, item.Phone); if (item.PaymentTypeIdNavigation != null) { var paymentTypeIdModel = new ApiPaymentTypeServerResponseModel(); paymentTypeIdModel.SetProperties( item.PaymentTypeIdNavigation.Id, item.PaymentTypeIdNavigation.Name); model.SetPaymentTypeIdNavigation(paymentTypeIdModel); } if (item.PetIdNavigation != null) { var petIdModel = new ApiPetServerResponseModel(); petIdModel.SetProperties( item.PetIdNavigation.Id, item.PetIdNavigation.AcquiredDate, item.PetIdNavigation.BreedId, item.PetIdNavigation.Description, item.PetIdNavigation.PenId, item.PetIdNavigation.Price); model.SetPetIdNavigation(petIdModel); } return(model); }
public virtual async Task <UpdateResponse <ApiPaymentTypeServerResponseModel> > Update( int id, ApiPaymentTypeServerRequestModel model) { var validationResult = await this.PaymentTypeModelValidator.ValidateUpdateAsync(id, model); if (validationResult.IsValid) { PaymentType record = this.DalPaymentTypeMapper.MapModelToEntity(id, model); await this.PaymentTypeRepository.Update(record); record = await this.PaymentTypeRepository.Get(id); ApiPaymentTypeServerResponseModel apiModel = this.DalPaymentTypeMapper.MapEntityToModel(record); await this.mediator.Publish(new PaymentTypeUpdatedNotification(apiModel)); return(ValidationResponseFactory <ApiPaymentTypeServerResponseModel> .UpdateResponse(apiModel)); } else { return(ValidationResponseFactory <ApiPaymentTypeServerResponseModel> .UpdateResponse(validationResult)); } }
public PaymentTypeUpdatedNotification(ApiPaymentTypeServerResponseModel record) { this.Record = record; }
public void SetPaymentTypeIdNavigation(ApiPaymentTypeServerResponseModel value) { this.PaymentTypeIdNavigation = value; }