|
| 1 | +using CleanArchitecture.Blazor.Application.Features.Identity.Dto; |
| 2 | + |
| 3 | +namespace CleanArchitecture.Blazor.Application.Features.Fluxor; |
| 4 | +[FeatureState] |
| 5 | +public class UserProfileState |
| 6 | +{ |
| 7 | + public UserProfile UserProfile { get; } |
| 8 | + public bool IsLoading { get; } |
| 9 | + public UserProfileState() |
| 10 | + { |
| 11 | + IsLoading = true; |
| 12 | + UserProfile = new() { Email= "", UserId="",UserName= "" }; |
| 13 | + } |
| 14 | + public UserProfileState(bool loading,UserProfile? userProfile) |
| 15 | + { |
| 16 | + IsLoading = loading; |
| 17 | + UserProfile = userProfile?? new() { Email = "", UserId = "", UserName = "" }; ; |
| 18 | + } |
| 19 | + public UserProfileState(ApplicationUserDto dto) |
| 20 | + { |
| 21 | + UserProfile = new UserProfile() |
| 22 | + { |
| 23 | + UserId = dto.Id, |
| 24 | + ProfilePictureDataUrl = dto.ProfilePictureDataUrl, |
| 25 | + Email = dto.Email, |
| 26 | + PhoneNumber = dto.PhoneNumber, |
| 27 | + DisplayName = dto.DisplayName, |
| 28 | + Provider = dto.Provider, |
| 29 | + UserName = dto.UserName, |
| 30 | + IsActive = dto.IsActive, |
| 31 | + TenantId = dto.TenantId, |
| 32 | + TenantName = dto.TenantName, |
| 33 | + SuperiorId = dto.SuperiorId, |
| 34 | + SuperiorName = dto.SuperiorName, |
| 35 | + AssignedRoles = dto.AssignedRoles, |
| 36 | + DefaultRole = dto.DefaultRole |
| 37 | + }; |
| 38 | + } |
| 39 | +} |
0 commit comments