I have an API which sends error status flag, error message and object of user. Currently I am using the API response class to get these responses.
public class UsersResponse
{
public int Status { get; set; }
public string Message { get; set; }
public List<User> Users { get; set; }`enter code here`
}
I receive the response in the instance of the above mentioned class and later display the result on the view. I get the response in the view's code behind file.
I was wondering if this is the right way to do it? If view models are used, will it be tackled by view model? If yes, then how will it be done.
I am thinking of getting into the habit of using view models rather than fully relying on the views code behind file.
The best way to tackle such a situation will be of great help and highly appreciated.
Thanks :)
Aucun commentaire:
Enregistrer un commentaire