public IActionResult Register([FromBody] RegisterModelForApartment request) { try { _apartmentService.Register(request); Log.Information("USER who is renting the apartment: {username} has registered", request.Name); //Debug.WriteLine($"User registered with {request.Username}"); return(Ok("Success")); } catch (ApartmentException ex) { Log.Error($"USER who is renitng the apartment: {ex.UserId}.{ex.Name}: {ex.Message}"); //Debug.WriteLine($"User {ex.UserId}.{ex.Name}: {ex.Message}"); return(BadRequest(ex.Message)); } catch (Exception ex) { Log.Error($"USER who is renting the apartment : {ex.Message}"); //Debug.WriteLine($"Unknown error: {ex.Message}"); return(BadRequest(ex.Message)); } }