Exemplo n.º 1
0
        public async Task SaveAsync(User User)
        {
            using (var db = new PokerTimeContext())
            {
                await db.Users.AddAsync(User);

                await db.SaveChangesAsync();
            }
        }
Exemplo n.º 2
0
        public async Task SaveAsync(Post post)
        {
            using (var db = new PokerTimeContext())
            {
                db.Users.Attach(post.Author);
                await db.Posts.AddAsync(post);

                await db.SaveChangesAsync();
            }
        }
Exemplo n.º 3
0
 public IEnumerable <Post> GetAllWithImages()
 {
     using (var db = new PokerTimeContext())
     {
         return(db.Posts
                .Include(p => p.Image)
                .OrderByDescending(p => p.CreatedDate)
                .ToList());
     }
 }
Exemplo n.º 4
0
 public Task <User> FindByEmailAndPassword(string email, string password)
 {
     using (var db = new PokerTimeContext())
     {
         return(db.Users
                .Where(u => u.Email.Equals(email) && u.Password.Equals(password))
                .Include(u => u.Image)
                .FirstOrDefaultAsync());
     }
 }