Beispiel #1
0
        public IList<Movie> Search(string Filter)
        {
            var entities = new MoviesDbContext();

            var query = (from c in entities.Movies
                         where c.Title.Contains(Filter)
                         select c).ToList();

            return query;
        }
Beispiel #2
0
        public Entities.Movie GetOne(int Id)
        {
            Entities.Movie result = null;

            var context = new MoviesDbContext();
            
            result = (from c in context.Movies.Include("Reviews")
                        where c.Id == Id
                        select c).FirstOrDefault(); 
            
            //using (var con = new SqlConnection(this.ConnectionString))
            //{
            //    result = con.Query<Entities.Movie>("usp_movies_get_one", 
            //        new {Id = Id },
            //        commandType: System.Data.CommandType.StoredProcedure).FirstOrDefault();
            //}
            return result;                 
        }
Beispiel #3
0
 public void CreateReview(Entities.Review Model)
 {
     var context = new MoviesDbContext();
     context.Reviews.Add(Model);
     context.SaveChanges();              
 }