Example #1
0
 internal void GetLinkedPosts()
 {
     using (var db = new DbAPIContext())
     {
         postsId = db.Posts.Where(p => p.UserId == Id).Select(p => p.Id).ToList();
     }
 }
Example #2
0
 internal void GetLinkedLikes()
 {
     using (var db = new DbAPIContext())
     {
         likesId = db.Likes.Where(l => l.UserId == Id).Select(l => l.Id).ToList();
     }
 }
Example #3
0
 internal void GetLinkedComments()
 {
     using (var db = new DbAPIContext())
     {
         commentsId = db.Comments.Where(c => c.UserId == Id).Select(c => c.Id).ToList();
     }
 }
Example #4
0
 internal void GetLinkedLikes()
 {
     using (var db = new DbAPIContext())
     {
         likes = db.Likes.Where(l => l.PostId == Id).ToList();
     }
 }
Example #5
0
 internal void GetLinkedComments()
 {
     using (var db = new DbAPIContext())
     {
         comments = db.Comments.Where(c => c.PostId == Id).ToList();
     }
 }
Example #6
0
 public void GetLinkedUsers()
 {
     using (var db = new DbAPIContext())
     {
         List <int> userIds = db.User_Groups.Where(ug => ug.GroupId == Id).Select(ug => ug.Id).ToList();
         users = db.Users.Where(u => userIds.Contains(u.Id)).ToList();
     }
 }
Example #7
0
 internal void GetLinkedGroups()
 {
     using (var db = new DbAPIContext())
     {
         List <int> groupsId = db.User_Groups.Where(ug => ug.UserId == Id).Select(ug => ug.UserId).ToList();
         groups = db.Groups.Where(g => groupsId.Any(gId => gId == g.Id)).ToList();
     }
 }
Example #8
0
 public void GetLinkedPosts()
 {
     using (var db = new DbAPIContext())
     {
         posts = db.Posts.Where(p => p.GroupId == Id).ToList();
         foreach (Post post in posts)
         {
             post.GetLinkedInformations();
         }
     }
 }
Example #9
0
        public static bool Authenticate(string id, string password)
        {
            if (id == null || password == null)
            {
                return(false);
            }

            using (var db = new DbAPIContext())
            {
                User user = db.Users.Find(int.Parse(id));
                if (user != null)
                {
                    return(user.Password == password);
                }
            }



            return(false);
        }
Example #10
0
        public static bool Authenticate(DbAPIContext context, int id, string password)
        {
            if (string.IsNullOrEmpty(password))
            {
                return(false);
            }

            User user = context.Users.Find(id);

            if (user == null)
            {
                return(false);
            }
            else if (user.Password != password)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Example #11
0
 public UsersController(DbAPIContext context)
 {
     this.context = context;
 }
Example #12
0
 public Repository(DbAPIContext db)
 {
     Db    = db;
     DbSet = db.Set <TEntity>();
 }
 public EstoqueRepository(DbAPIContext context) : base(context)
 {
 }
 public InMemoryBookRepository(DbAPIContext context)
 {
     _context = context;
 }
Example #15
0
 public CommentsController(DbAPIContext context)
 {
     this.context = context;
 }
Example #16
0
 public SearchController(DbAPIContext context)
 {
     this.context = context;
 }
Example #17
0
 public FluxController(DbAPIContext context)
 {
     this.context = context;
 }
 public ProdutoRepository(DbAPIContext context) : base(context)
 {
 }
Example #19
0
 public GroupsController(DbAPIContext context)
 {
     this.context = context;
 }
Example #20
0
 public LikesController(DbAPIContext context)
 {
     this.context = context;
 }
Example #21
0
 public LojaRepository(DbAPIContext context) : base(context)
 {
 }
Example #22
0
 public PostsController(DbAPIContext context)
 {
     this.context = context;
 }