public static DataModel.Student ApiToEntityModel(ApiModel.Student apiStudent) { var address = new DataModel.Address(); var dataStudent = new DataModel.Student(); var dataPerson = new DataModel.Person(); //address address.City = apiStudent.Address.City; address.State = apiStudent.Address.State; address.StreetAndNumber = apiStudent.Address.StreetAndNumber; address.ZipCode = apiStudent.Address.ZipCode; //person entity dataPerson.Birthday = apiStudent.Birthday; dataPerson.FirstName = apiStudent.FirstName; dataPerson.LastName = apiStudent.LastName; dataPerson.MiddleName = apiStudent.MiddleName; dataPerson.Phone = apiStudent.Phone; //Major dataStudent.MajorId = (long)apiStudent.MajorId; dataPerson.Address = address; dataStudent.Person = dataPerson; return(dataStudent); }
public static DataModel.Professor ApiToEntityModel(ApiModel.Professor apiProfessor) { var address = new DataModel.Address(); var dataProfessor = new DataModel.Professor(); var dataPerson = new DataModel.Person(); //address address.City = apiProfessor.Address.City; address.State = apiProfessor.Address.State; address.StreetAndNumber = apiProfessor.Address.StreetAndNumber; address.ZipCode = apiProfessor.Address.ZipCode; //person entity dataPerson.Birthday = apiProfessor.Birthday; dataPerson.FirstName = apiProfessor.FirstName; dataPerson.LastName = apiProfessor.LastName; dataPerson.MiddleName = apiProfessor.MiddleName; dataPerson.Phone = apiProfessor.Phone; //Major dataProfessor.ProfessionalLicense = apiProfessor.ProfessionalLicense; dataPerson.Address = address; dataProfessor.Person = dataPerson; return(dataProfessor); }