Пример #1
0
        public virtual ApiCallPersonServerResponseModel MapEntityToModel(
            CallPerson item)
        {
            var model = new ApiCallPersonServerResponseModel();

            model.SetProperties(item.Id,
                                item.Note,
                                item.PersonId,
                                item.PersonTypeId);
            if (item.PersonIdNavigation != null)
            {
                var personIdModel = new ApiPersonServerResponseModel();
                personIdModel.SetProperties(
                    item.PersonIdNavigation.Id,
                    item.PersonIdNavigation.FirstName,
                    item.PersonIdNavigation.LastName,
                    item.PersonIdNavigation.Phone,
                    item.PersonIdNavigation.Ssn);

                model.SetPersonIdNavigation(personIdModel);
            }

            if (item.PersonTypeIdNavigation != null)
            {
                var personTypeIdModel = new ApiPersonTypeServerResponseModel();
                personTypeIdModel.SetProperties(
                    item.PersonTypeIdNavigation.Id,
                    item.PersonTypeIdNavigation.Name);

                model.SetPersonTypeIdNavigation(personTypeIdModel);
            }

            return(model);
        }
Пример #2
0
        public virtual ApiCallPersonServerResponseModel MapServerRequestToResponse(
            int id,
            ApiCallPersonServerRequestModel request)
        {
            var response = new ApiCallPersonServerResponseModel();

            response.SetProperties(id,
                                   request.Note,
                                   request.PersonId,
                                   request.PersonTypeId);
            return(response);
        }