Updated so deleteUser gives the correct answer back in dbAccess and checks if the user could be saved to the db
This commit is contained in:
parent
007c0e093c
commit
4bcdc99c8b
@ -36,8 +36,11 @@ namespace Api.DBAccess
|
|||||||
}
|
}
|
||||||
|
|
||||||
_context.Users.Add(user);
|
_context.Users.Add(user);
|
||||||
|
bool saved = await _context.SaveChangesAsync() == 1;
|
||||||
return new OkObjectResult(await _context.SaveChangesAsync());
|
|
||||||
|
if (saved) { return new OkObjectResult(true); }
|
||||||
|
|
||||||
|
return new ConflictObjectResult(new { message = "Could not save to databse" });
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<User> Login(Login login)
|
public async Task<User> Login(Login login)
|
||||||
@ -108,7 +111,7 @@ namespace Api.DBAccess
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_context.Users.Remove(user);
|
_context.Users.Remove(user);
|
||||||
bool saved = await _context.SaveChangesAsync() == 1;
|
bool saved = await _context.SaveChangesAsync() >= 0;
|
||||||
|
|
||||||
if (saved) { return new OkObjectResult(saved); }
|
if (saved) { return new OkObjectResult(saved); }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user