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 ApiSaleServerResponseModel MapServerRequestToResponse(
            int id,
            ApiSaleServerRequestModel request)
        {
            var response = new ApiSaleServerResponseModel();

            response.SetProperties(id,
                                   request.Amount,
                                   request.CutomerId,
                                   request.Note,
                                   request.PetId,
                                   request.SaleDate,
                                   request.SalesPersonId);
            return(response);
        }