Projekt

Obecné

Profil

« Předchozí | Další » 

Revize fc0e5b36

Přidáno uživatelem Vojtěch Bartička před asi 2 roky(ů)

Changed formatting, added comments, database check

Zobrazit rozdíly:

Backend/Core/Services/UserService/UserServiceEF.cs
49 49
                }
50 50
                return u;
51 51
            }
52
            catch (Exception ex)
52
            catch (Exception)
53 53
            {
54 54
                _logger.Information($"No user with username {username} found.");
55 55
                return null;
......
65 65
                return null;
66 66
            }
67 67

  
68
            User user = new User() { Username = username, Name = name, Surname = surname, Password = BCrypt.Net.BCrypt.HashPassword(password), Role = role };
68
            User user = new User()
69
            {
70
                Username = username,
71
                Name = name,
72
                Surname = surname,
73
                Password = BCrypt.Net.BCrypt.HashPassword(password),
74
                Role = role
75
            };
69 76
            _databaseContext.Users.Add(user);
70 77
            _databaseContext.SaveChanges();
71 78
            return user;
......
79 86
                User user = _databaseContext.Users.First(u => u.Username == username);
80 87
                return user;
81 88
            }
82
            catch (InvalidOperationException ex)
89
            catch (InvalidOperationException)
83 90
            {
84 91
                _logger.Warning($"No user with the username {username} found.");
85 92
                return null;
......
94 101
                User user = _databaseContext.Users.First(u => u.Id == id);
95 102
                return user;
96 103
            }
97
            catch (InvalidOperationException ex)
104
            catch (InvalidOperationException)
98 105
            {
99 106
                _logger.Warning($"No user with the GUID {id} found.");
100 107
                return null;

Také k dispozici: Unified diff