Esempio n. 1
0
        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);
        }
Esempio n. 3
0
        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);
        }