Ejemplo n.º 1
0
        public LoginForm(MovieDbEntities context = null)
        {
            db = context ?? new MovieDbEntities();
            InitializeComponent();

            GlassMargins = new Margins(0, 0, 48, 48);
        }
Ejemplo n.º 2
0
 public UsersForm(MovieDbEntities context)
 {
     _entities = context;
     InitializeComponent();
     var data = _entities.Users;
     dataListView1.DataSource = data;
 }
Ejemplo n.º 3
0
        public KeywordsForm(MovieDbEntities context)
        {
            _db = context;
            InitializeComponent();

            dataListView1.DataSource = _db.Keywords;
        }
Ejemplo n.º 4
0
        public MovieListForm(User user, MovieDbEntities context = null)
        {
            _user = user;
            _entities = context ?? new MovieDbEntities();
            InitializeComponent();

            dataListView1.DataSource = _entities.UserLists.Where(o => o.User.Id == _user.Id);
        }
 public MovieBrowserController()
 {
     try
     {
         _entities = new MovieDbEntities();
         DbLoggedIn = false;
     }
     catch (Exception exception)
     {
         Logger.Exception(exception, 43);
     }
 }
        private static MoviePersonalNote GetNote(MovieDbEntities db, User loggedInUser, Movie rowMovie)
        {
            try
            {
                var user = db.Users.Where(o => o.Username == loggedInUser.Username).FirstOrDefault();
                var movie = db.Movies.Where(o => o.ImdbId == rowMovie.ImdbId).FirstOrDefault();

                if (movie == null)
                {
                    rowMovie.IsUpdated = false;
                    db.AddToMovies(rowMovie);
                    movie = rowMovie;
                }

                var personalNote =
                    db.MoviePersonalNotes.Where(o => o.User.Id == loggedInUser.Id && o.Movie.Id == movie.Id).
                        FirstOrDefault();

                if (personalNote == null)
                {
                    personalNote = new MoviePersonalNote { Comment = "", Movie = movie, User = user };
                    db.AddToMoviePersonalNotes(personalNote);
                }
                return personalNote;
            }
            catch (Exception exp)
            {
                Logger.Exception(exp, 550);
                return null;
            }
        }