Exemplo n.º 1
0
 public bool CheckIfContainedHash(string hash)
 {
     using (var ctx = new BitlyContext(_connectionString))
     {
         return(ctx.Bitlies.Any(b => b.Hash == hash));
     }
 }
Exemplo n.º 2
0
 public void AddUser(User user, string password)
 {
     user.PasswordHash = BCrypt.Net.BCrypt.HashPassword(password);
     using (var ctx = new BitlyContext(_connectionString))
     {
         ctx.Users.Add(user);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 3
0
 public void AddView(int bitlyid, int views)
 {
     using (var ctx = new BitlyContext(_connectionString))
     {
         ctx.Database.ExecuteSqlCommand("UPDATE Bitly SET Views = @view WHERE Id = @id",
                                        new SqlParameter("@view", views + 1),
                                        new SqlParameter("@id", bitlyid));
     }
 }
Exemplo n.º 4
0
 public int AddBitly(Bitly b)
 {
     using (var ctx = new BitlyContext(_connectionString))
     {
         ctx.Bitlies.Add(b);
         ctx.SaveChanges();
         return(b.Id);
     }
 }