Exemple #1
0
        public virtual ApiEventServerResponseModel MapEntityToModel(
            Event item)
        {
            var model = new ApiEventServerResponseModel();

            model.SetProperties(item.Id,
                                item.Address1,
                                item.Address2,
                                item.CityId,
                                item.Date,
                                item.Description,
                                item.EndDate,
                                item.Facebook,
                                item.Name,
                                item.StartDate,
                                item.Website);
            if (item.CityIdNavigation != null)
            {
                var cityIdModel = new ApiCityServerResponseModel();
                cityIdModel.SetProperties(
                    item.CityIdNavigation.Id,
                    item.CityIdNavigation.Name,
                    item.CityIdNavigation.ProvinceId);

                model.SetCityIdNavigation(cityIdModel);
            }

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

            response.SetProperties(id,
                                   request.Name,
                                   request.ProvinceId);
            return(response);
        }
Exemple #3
0
        public virtual ApiCityServerResponseModel MapEntityToModel(
            City item)
        {
            var model = new ApiCityServerResponseModel();

            model.SetProperties(item.Id,
                                item.Name,
                                item.ProvinceId);
            if (item.ProvinceIdNavigation != null)
            {
                var provinceIdModel = new ApiProvinceServerResponseModel();
                provinceIdModel.SetProperties(
                    item.ProvinceIdNavigation.Id,
                    item.ProvinceIdNavigation.CountryId,
                    item.ProvinceIdNavigation.Name);

                model.SetProvinceIdNavigation(provinceIdModel);
            }

            return(model);
        }