Exemplo n.º 1
0
 public void Delete(Score score)
 {
     using (var db = new DbSocialReader())
     {
         db.Delete(score);
     }
 }
Exemplo n.º 2
0
 public void Update(Genre genre)
 {
     using (var db = new DbSocialReader())
     {
         db.Update(genre);
     }
 }
Exemplo n.º 3
0
 public void Delete(Text text)
 {
     using (var db = new DbSocialReader())
     {
         db.Delete(text);
     }
 }
Exemplo n.º 4
0
 public void Update(User user)
 {
     using (var db = new DbSocialReader())
     {
         db.Update(user);
     }
 }
Exemplo n.º 5
0
        // Nullable
        public Text GetById(int id)
        {
            using (var db = new DbSocialReader())
            {
                var query = from text in db.Text
                            join textToAuthor in db.TextToAuthor on text.Id equals textToAuthor.TextId
                            join author in db.Author on textToAuthor.AuthorId equals author.Id
                            where text.Id == id
                            select new { text, author };

                if (query.Count() == 0)
                {
                    return(null);
                }

                var result = query.First().text;
                foreach (var arr in query.ToArray())
                {
                    Console.WriteLine(arr);
                    result.AddAuthor(arr.author);
                }

                return(result);
            }
        }
Exemplo n.º 6
0
 public void Update(Text text)
 {
     using (var db = new DbSocialReader())
     {
         db.Update(text);
     }
 }
Exemplo n.º 7
0
 public void Delete(User user)
 {
     using (var db = new DbSocialReader())
     {
         db.Delete(user);
     }
 }
Exemplo n.º 8
0
 public void Delete(Author author)
 {
     using (var db = new DbSocialReader())
     {
         db.Delete(author);
     }
 }
Exemplo n.º 9
0
 public void Update(Author author)
 {
     using (var db = new DbSocialReader())
     {
         db.Update(author);
     }
 }
Exemplo n.º 10
0
 public void Delete(Genre genre)
 {
     using (var db = new DbSocialReader())
     {
         db.Delete(genre);
     }
 }
Exemplo n.º 11
0
        // Nullable
        public Account GetByUsername(string username)
        {
            using (var db = new DbSocialReader())
            {
                /*var query = from a in db.Account
                 *          where a.Username == username
                 *          select a;
                 *
                 * return query.FirstOrDefault();*/

                //db.Account.LoadWith(a=>a.Users).Where(a.Users.Where(User ))
                var query = from a in db.Account
                            join user in db.User
                            on a.Id equals user.AccountId
                            where a.Username == username
                            select new { a, user };

                /*Console.WriteLine(query.First().a);
                *  Console.WriteLine(query.First().user);
                *  Console.WriteLine(query.ToArray());*/
                if (query.Count() == 0)
                {
                    return(null);
                }
                var account = query.First().a;
                foreach (var arr in query.ToArray())
                {
                    //Console.WriteLine("arr.user: " + arr.user);
                    account.Users.Add(arr.user);
                }
                //account.Users.AddRange(query.First().users);
                return(account);
            }
        }
Exemplo n.º 12
0
 public void Update(Score score)
 {
     using (var db = new DbSocialReader())
     {
         db.Update(score);
     }
 }
Exemplo n.º 13
0
 public void Update(Account account)
 {
     using (var db = new DbSocialReader())
     {
         db.Update(account);
     }
 }
Exemplo n.º 14
0
 public void Delete(Note note)
 {
     using (var db = new DbSocialReader())
     {
         db.Delete(note);
     }
 }
Exemplo n.º 15
0
 public void Delete(Account account)
 {
     using (var db = new DbSocialReader())
     {
         db.Delete(account);
     }
 }
Exemplo n.º 16
0
 public void Update(Note note)
 {
     using (var db = new DbSocialReader())
     {
         db.Update(note);
     }
 }
Exemplo n.º 17
0
 public List <Note> GetNotes()
 {
     using (var db = new DbSocialReader())
     {
         var query = from a in db.Note select a;
         return(query.ToList());
     }
 }
Exemplo n.º 18
0
 // Nullable
 public Note Read(int id)
 {
     using (var db = new DbSocialReader())
     {
         var q = from t in db.Note.LoadWith(prop => prop.User) where t.Id == id select t;
         return(q.FirstOrDefault());
     }
 }
Exemplo n.º 19
0
 public List <Genre> GetGenres()
 {
     using (var db = new DbSocialReader())
     {
         var query = from g in db.Genre select g;
         return(query.ToList());
     }
 }
Exemplo n.º 20
0
 public static List <User> All()
 {
     using (var db = new DbSocialReader())
     {
         var query = from u in db.User select u;
         return(query.ToList());
     }
 }
Exemplo n.º 21
0
 public List <Account> All()
 {
     using (var db = new DbSocialReader())
     {
         var query = from a in db.Account select a;
         return(query.ToList());
     }
 }
Exemplo n.º 22
0
        /**
         *
         * Get all authors from database
         *
         */
        public List <Author> GetAuthors()
        {
            using (var db = new DbSocialReader())
            {
                var query = from a in db.Author
                            select a;

                return(query.ToList());
            }
        }
Exemplo n.º 23
0
        public List <Score> GetScores()
        {
            using (var db = new DbSocialReader())
            {
                var query = from s in db.Score
                            select s;

                return(query.ToList());
            }
        }
Exemplo n.º 24
0
        public Author GetById(int id)
        {
            using (var db = new DbSocialReader())
            {
                var query = from a in db.Author
                            where a.Id == id
                            select a;

                return(query.FirstOrDefault());
            }
        }
Exemplo n.º 25
0
        // Nullable
        public Genre GetById(int id)
        {
            using (var db = new DbSocialReader())
            {
                var query = from g in db.Genre
                            where g.Id == id
                            select g;

                return(query.FirstOrDefault());
            }
        }
Exemplo n.º 26
0
        // Nullable
        public User GetByName(string name)
        {
            using (var db = new DbSocialReader())
            {
                var query = from u in db.User
                            where u.Name == name
                            select u;

                return(query.FirstOrDefault());
            }
        }
Exemplo n.º 27
0
        // Nullable
        public User GetById(int id)
        {
            using (var db = new DbSocialReader())
            {
                var query = from u in db.User
                            where u.Id == id
                            select u;

                return(query.FirstOrDefault());
            }
        }
Exemplo n.º 28
0
        public Genre GetByName(string name)
        {
            using (var db = new DbSocialReader())
            {
                var query = from g in db.Genre
                            where g.Name == name
                            select g;

                return(query.FirstOrDefault());
            }
        }
Exemplo n.º 29
0
        public Author GetByName(string name)
        {
            using (var db = new DbSocialReader())
            {
                var query = from a in db.Author
                            where a.Name == name
                            select a;

                return(query.FirstOrDefault());
            }
        }
Exemplo n.º 30
0
        // Nullable
        public Score Read(int id)
        {
            using (var db = new DbSocialReader())
            {
                var query = from s in db.Score
                            where s.Id == id
                            select s;

                return(query.FirstOrDefault());
            }
        }