Пример #1
0
 internal void GetLinkedPosts()
 {
     using (var db = new DbAPIContext())
     {
         postsId = db.Posts.Where(p => p.UserId == Id).Select(p => p.Id).ToList();
     }
 }
Пример #2
0
 internal void GetLinkedLikes()
 {
     using (var db = new DbAPIContext())
     {
         likesId = db.Likes.Where(l => l.UserId == Id).Select(l => l.Id).ToList();
     }
 }
Пример #3
0
 internal void GetLinkedComments()
 {
     using (var db = new DbAPIContext())
     {
         commentsId = db.Comments.Where(c => c.UserId == Id).Select(c => c.Id).ToList();
     }
 }
Пример #4
0
 internal void GetLinkedLikes()
 {
     using (var db = new DbAPIContext())
     {
         likes = db.Likes.Where(l => l.PostId == Id).ToList();
     }
 }
Пример #5
0
 internal void GetLinkedComments()
 {
     using (var db = new DbAPIContext())
     {
         comments = db.Comments.Where(c => c.PostId == Id).ToList();
     }
 }
Пример #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();
     }
 }
Пример #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();
     }
 }
Пример #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();
         }
     }
 }
Пример #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);
        }
Пример #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);
            }
        }
Пример #11
0
 public UsersController(DbAPIContext context)
 {
     this.context = context;
 }
Пример #12
0
 public Repository(DbAPIContext db)
 {
     Db    = db;
     DbSet = db.Set <TEntity>();
 }
Пример #13
0
 public EstoqueRepository(DbAPIContext context) : base(context)
 {
 }
 public InMemoryBookRepository(DbAPIContext context)
 {
     _context = context;
 }
Пример #15
0
 public CommentsController(DbAPIContext context)
 {
     this.context = context;
 }
Пример #16
0
 public SearchController(DbAPIContext context)
 {
     this.context = context;
 }
Пример #17
0
 public FluxController(DbAPIContext context)
 {
     this.context = context;
 }
Пример #18
0
 public ProdutoRepository(DbAPIContext context) : base(context)
 {
 }
Пример #19
0
 public GroupsController(DbAPIContext context)
 {
     this.context = context;
 }
Пример #20
0
 public LikesController(DbAPIContext context)
 {
     this.context = context;
 }
Пример #21
0
 public LojaRepository(DbAPIContext context) : base(context)
 {
 }
Пример #22
0
 public PostsController(DbAPIContext context)
 {
     this.context = context;
 }