Added login endpoint
Started adding endpoint to login users
This commit is contained in:
@@ -30,6 +30,20 @@ public class UsersRepository
|
||||
#endregion
|
||||
|
||||
#region Metods
|
||||
public Tuple<bool, User> Exists(User user)
|
||||
{
|
||||
var allUsers = this.RetrieveAllUsers();
|
||||
var result = allUsers.FirstOrDefault(ea => ea.Username!.Equals(user.Username));
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
return new Tuple<bool, User>(true, result!);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Tuple<bool, User>(false, new User());
|
||||
}
|
||||
}
|
||||
public void CreateUser(User user)
|
||||
{
|
||||
this._bookCollection.InsertOne(user);
|
||||
@@ -92,6 +106,11 @@ public class SaltRepository
|
||||
return this._bookCollection.Find(_ => true).ToList();
|
||||
}
|
||||
|
||||
public Salt Retrieve(string userId)
|
||||
{
|
||||
return this._bookCollection.Find(s => s.UserId.Equals(userId)).FirstOrDefault();
|
||||
}
|
||||
|
||||
public void Update(Salt salt)
|
||||
{
|
||||
var filter = Builders<Salt>.Filter.Eq(u => u.Id, salt.Id);
|
||||
|
||||
Reference in New Issue
Block a user