Esempio n. 1
0
        public IEnumerable <UserModel> Select()
        {
            var sql = "SELECT * FROM public.user";

            var results = _postgreSQL.Query <UserModel>(sql);

            return(results);
        }
Esempio n. 2
0
        public List <NotesModel> Select(int user_id)
        {
            var sql        = "SELECT * FROM public.notes WHERE user_id=@user_id";
            var parameters = new { user_id };

            return(_postgreSQL.Query <NotesModel>(sql, parameters).ToList());
        }
        public List <FavoriteModel> Select(int userId)
        {
            var sql        = "SELECT * FROM public.favorited WHERE user_id = @UserId";
            var parameters = new { UserId = userId };

            var results = _postgreSQL.Query <FavoriteModel>(sql, parameters);

            return(results.ToList());
        }
        public List <FavoriteNotesModel> Select(int user_id)
        {
            var sql = "SELECT " +
                      "favorited.id favorited_id, " +
                      "favorited.recipe_id," +
                      "favorited.favorited_title, " +
                      "notes.id notes_id, " +
                      "notes.notes " +
                      "FROM favorited LEFT JOIN notes " +
                      "ON favorited.id = notes.favorited_id " +
                      "WHERE " +
                      "favorited.user_id = @user_id " +
                      "ORDER BY favorited_id DESC; ";

            var parameters = new { user_id };

            var results = _postgreSQL.Query <FavoriteNotesModel>(sql, parameters);

            return(results.ToList());
        }