Пример #1
0
        public void Createuser(User user) //indsætter brugernavn, password og email i databasen under "user"
        {
            var ctx = new Databasecontext();

            ctx.Database.ExecuteSqlInterpolated($"select createUser({user.username},{user.password},{user.email})");
        }
Пример #2
0
        public IList <SearchHistory> GetSearchHistory(int userid)
        {
            var ctx = new Databasecontext();

            return(ctx.SearchHistory.Where(x => x.Userid == userid).OrderByDescending(x => x.SearchDate).ToList());
        }
Пример #3
0
        public User GetUser(string username, string password)
        {
            var ctx = new Databasecontext();

            return(ctx.User.FirstOrDefault(x => x.username == username && x.password == password));
        }
Пример #4
0
        public IList <SearchHistory> GetSearchHistory(int?userid)
        {
            var ctx = new Databasecontext();

            return(ctx.SearchHistory.ToList());
        }
Пример #5
0
        private List <User> _users = testdata.Users; //Henter dummy data til authorization

        /*
         * public User GetUser(string username) // Current user, hentet fra dummy data
         * {
         *
         *  return _users.FirstOrDefault(x => x.username == username);
         *
         * }
         *
         * /*public User GetUser(int id)
         * {
         *  return _users.FirstOrDefault(x => x.userid == id);
         * } */

        public IList <User> GetUsers()
        {
            var ctx = new Databasecontext();

            return(ctx.User.ToList());
        }