c# - Converter class in MVC -


may please explain converter class? equivalent of converter class in mvc? in similar model or ??

public  class converter {       public countrydto countriestocountrydto(countries e)     {         return new countrydto         {             countryid = e.countryid,             countryname = e.countryname         };     }      public  list<countrydto> lcountriestocountrydto(list<countries> e)             {         list<countrydto> lstcountrydto = e.select(           country => new countrydto()           {               countryid = country.countryid,               countryname = country.countryname           }).tolist();         return lstcountrydto;      } 

this plain simple c# class, not mvc specific, not model related. functions them selves convert countries , list of countries objects respective dto objects. model in mvc countain 1 or more properties able hold data (variables, lists, objects) without functions , implementation in example.

it :

public class converter {     public countrydto countrydto { get; set; }     public list<countrydto> countriesdto {get; set;} } 

altho doubt makes sense in context.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -