Esempio n. 1
0
        public virtual ApiSaleServerResponseModel MapEntityToModel(
            Sale item)
        {
            var model = new ApiSaleServerResponseModel();

            model.SetProperties(item.Id,
                                item.Amount,
                                item.CutomerId,
                                item.Note,
                                item.PetId,
                                item.SaleDate,
                                item.SalesPersonId);
            if (item.PetIdNavigation != null)
            {
                var petIdModel = new ApiPetServerResponseModel();
                petIdModel.SetProperties(
                    item.PetIdNavigation.Id,
                    item.PetIdNavigation.BreedId,
                    item.PetIdNavigation.ClientId,
                    item.PetIdNavigation.Name,
                    item.PetIdNavigation.Weight);

                model.SetPetIdNavigation(petIdModel);
            }

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

            response.SetProperties(id,
                                   request.BreedId,
                                   request.ClientId,
                                   request.Name,
                                   request.Weight);
            return(response);
        }
Esempio n. 3
0
        public virtual ApiPetServerResponseModel MapEntityToModel(
            Pet item)
        {
            var model = new ApiPetServerResponseModel();

            model.SetProperties(item.Id,
                                item.BreedId,
                                item.ClientId,
                                item.Name,
                                item.Weight);
            if (item.BreedIdNavigation != null)
            {
                var breedIdModel = new ApiBreedServerResponseModel();
                breedIdModel.SetProperties(
                    item.BreedIdNavigation.Id,
                    item.BreedIdNavigation.Name,
                    item.BreedIdNavigation.SpeciesId);

                model.SetBreedIdNavigation(breedIdModel);
            }

            return(model);
        }