Exemplo n.º 1
0
 public GenreModel FindGenreById(int id)
 {
     using (UmuseEntities context = new UmuseEntities())
     {
         var rawEntity = (from g in context.Genre where g.ID == id select g).FirstOrDefault();
         var model     = new GenreModel()
         {
             ID = rawEntity.ID, GenreName = rawEntity.GenreName
         };
         return(model);
     }
 }
Exemplo n.º 2
0
        public IEnumerable <GenreModel> FindManyGenres()
        {
            using (UmuseEntities context = new UmuseEntities())
            {
                var rawEntities = (from g in context.Genre select g).ToArray();
                var models      = (from g in rawEntities
                                   select new GenreModel()
                {
                    ID = g.ID,
                    GenreName = g.GenreName
                }).ToArray();

                return(models);
            }
        }