public static List <StudentTransferObject> ToActionResultTo(this List <Student> result) { List <StudentTransferObject> to = new List <StudentTransferObject>(); foreach (var student in result) { StudentTransferObject studentTransferObject = new StudentTransferObject(); studentTransferObject = student.ToStudentTo(); to.Add(studentTransferObject); } return(to); }
public static StudentTransferObject ToStudentTo(this Student student) { if (student == null) { student = new Student(); } StudentTransferObject to = new StudentTransferObject(); to.StudentID = student.StudentID; to.StudentName = student.StudentName; to.StudentSurname = student.StudentSurname; to.StudentSex = student.StudentSex; to.StudentAge = student.StudentAge; to.Mark = student.Mark; to.Subject = student.Subject; to.MarkAvg = student.MarkAvg; to.SubjectTotal = student.SubjectTotal; //to.Subject = student.Subject; return(to); }
public void PostSomething([FromBody] StudentTransferObject studentInformation) { //do something }