public ActionResult <ApartmentProfileModel> Authenticate( [FromBody] ApartmentLogInModel request) { try { var response = _apartmentService .Authenticate(request.Name, request.Password); Log.Information($"USER who is renting an apartment: {response.Name} has logged in"); //Debug.WriteLine($"{response.Id} has been loged in"); return(Ok(response)); } catch (ApartmentException ex) { Log.Error($"USER who is renting 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: {message}", ex.Message); //Debug.WriteLine(ex.Message); return(BadRequest("Something went wrong!")); } }