SES-105 list of logged charcters #36

Merged
s426134 merged 7 commits from SES-105 into dev 2020-12-21 13:40:47 +01:00
Showing only changes of commit 6350ad7239 - Show all commits

View File

@ -61,16 +61,16 @@ namespace SessionCompanion.Controllers
public async Task<Either<SuccessResponse, ErrorResponse>> Register(UserRegisterViewModel userRegisterModel)
{
if (!ModelState.IsValid)
{
return new ErrorResponse() { StatusCode = 400, Message = "Given model is incorect" };
}
if (await _service.SearchUserByUsername(userRegisterModel.Username) is not null)
return new ErrorResponse() { StatusCode = 400, Message = "Given user is already registered" };
UserViewModel userModel = new UserViewModel()
{
Password = userRegisterModel.Password,
Username = userRegisterModel.Username
};
await _service.Create(userModel);
await _service.SaveAsync();