Пример #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);
        }
Пример #2
0
        public virtual ApiEventServerResponseModel MapServerRequestToResponse(
            int id,
            ApiEventServerRequestModel request)
        {
            var response = new ApiEventServerResponseModel();

            response.SetProperties(id,
                                   request.Address1,
                                   request.Address2,
                                   request.CityId,
                                   request.Date,
                                   request.Description,
                                   request.EndDate,
                                   request.Facebook,
                                   request.Name,
                                   request.StartDate,
                                   request.Website);
            return(response);
        }