Transcript for:
Returning Complex Objects from an API in VBPI

welcome back to vbpi tutorials I am venkat this is part 7 in previous video we have seen how to written a simple string from our action method or endpoint in this video we are going to look at how can we return the complex object direct class or a list of classes from an API yeah previously we have added two controllers values controller is no more required so this is the student controller so let's modify this to the list in numerable of student get students okay let's create the type of the student for that we need to add a model s folder I have added models folder inside that I'm adding a new class that class name is a student that's the student here I want to add a student ID and student name uh then email address then string student address these are the four Fields I want to save as part of student okay let's return the list of students here import this namespace now let's return new list of student ID equal to 1 student name equal to student student 1 email equal to email1@gmail.com then address equal to Hyderabad India that's the data let's create to instances of it this is one student and this is the other student okay this is my action method get students this is returning list I enumerable of student so here I'm preparing the list of students okay for now I have created two students list and I'm returning it okay this time we can see the student details instead of the simple string try it out execute see there are two different student details we are returning one student one email one Hyderabad India then stood into two student to email Bangalore India that's how we can return the complex object from an endpoint okay here if we look at all this student data creating here it's not looking nice it's not a standard thing so let's move this data to the repository let's create some static repository let's do the operations from that Repository for more videos like this please like share and subscribe thank you