private UserModel GetUserStateInfo(Boolean isAuthenticated, String username, Int32 id = 0) { var model = new UserModel() { IsAuthenticated = isAuthenticated, Username = username }; if (id > 0) { try { IDelightServices service = new DelightServices(); AccountAvatarDTO info = service.GetUserStateInfo(id); model.Remember = info.Remember; if (model.Remember) { model.Username = info.Username; model.Avatar = DataUriSchemeProvider.CreatePNGImage(info.Avatar); } if (model.IsAuthenticated) { model.Role = info.Role; } } catch (RepositoryException) { } } return model; }
public UserModel(UserModel model) : base(model) { IsAuthenticated = model.IsAuthenticated; Avatar = model.Avatar; }
private UserModel GetUserStateInfo(Boolean isAuthenticated, String username, Int32 id = 0) { var model = new UserModel() { IsAuthenticated = isAuthenticated, Username = username }; if (id > 0) { try { using (var repository = new AccountRepository()) { var info = repository.GetUserStateInfo(id); model.Remember = info.Remember; if (model.Remember) { model.Username = info.Username; } model.Avatar = DataUriSchemeProvider.CreatePNGImage(info.Avatar); } } catch (RepositoryException) { } } return model; }