public virtual ApiTransactionStatusClientRequestModel MapServerResponseToClientRequest(
            ApiTransactionStatusServerResponseModel response)
        {
            var request = new ApiTransactionStatusClientRequestModel();

            request.SetProperties(
                response.Name);
            return(request);
        }
Esempio n. 2
0
        public virtual ApiTransactionStatusServerResponseModel MapEntityToModel(
            TransactionStatus item)
        {
            var model = new ApiTransactionStatusServerResponseModel();

            model.SetProperties(item.Id,
                                item.Name);

            return(model);
        }
        public virtual ApiTransactionStatusServerResponseModel MapServerRequestToResponse(
            int id,
            ApiTransactionStatusServerRequestModel request)
        {
            var response = new ApiTransactionStatusServerResponseModel();

            response.SetProperties(id,
                                   request.Name);
            return(response);
        }
        public void MapEntityToModel()
        {
            var mapper             = new DALTransactionStatusMapper();
            TransactionStatus item = new TransactionStatus();

            item.SetProperties(1, "A");
            ApiTransactionStatusServerResponseModel response = mapper.MapEntityToModel(item);

            response.Id.Should().Be(1);
            response.Name.Should().Be("A");
        }
Esempio n. 5
0
        public virtual ApiTransactionServerResponseModel MapEntityToModel(
            Transaction item)
        {
            var model = new ApiTransactionServerResponseModel();

            model.SetProperties(item.Id,
                                item.Amount,
                                item.GatewayConfirmationNumber,
                                item.TransactionStatusId);
            if (item.TransactionStatusIdNavigation != null)
            {
                var transactionStatusIdModel = new ApiTransactionStatusServerResponseModel();
                transactionStatusIdModel.SetProperties(
                    item.TransactionStatusIdNavigation.Id,
                    item.TransactionStatusIdNavigation.Name);

                model.SetTransactionStatusIdNavigation(transactionStatusIdModel);
            }

            return(model);
        }
        public virtual async Task <UpdateResponse <ApiTransactionStatusServerResponseModel> > Update(
            int id,
            ApiTransactionStatusServerRequestModel model)
        {
            var validationResult = await this.TransactionStatusModelValidator.ValidateUpdateAsync(id, model);

            if (validationResult.IsValid)
            {
                TransactionStatus record = this.DalTransactionStatusMapper.MapModelToEntity(id, model);
                await this.TransactionStatusRepository.Update(record);

                record = await this.TransactionStatusRepository.Get(id);

                ApiTransactionStatusServerResponseModel apiModel = this.DalTransactionStatusMapper.MapEntityToModel(record);
                await this.mediator.Publish(new TransactionStatusUpdatedNotification(apiModel));

                return(ValidationResponseFactory <ApiTransactionStatusServerResponseModel> .UpdateResponse(apiModel));
            }
            else
            {
                return(ValidationResponseFactory <ApiTransactionStatusServerResponseModel> .UpdateResponse(validationResult));
            }
        }
Esempio n. 7
0
 public void SetTransactionStatusIdNavigation(ApiTransactionStatusServerResponseModel value)
 {
     this.TransactionStatusIdNavigation = value;
 }
 public TransactionStatusUpdatedNotification(ApiTransactionStatusServerResponseModel record)
 {
     this.Record = record;
 }