public Domain.Models.User GetCurrentUser() { var currentContext = GetContext(); var usersRealm = new Domain.Services.Realms.Users(); var username = currentContext.Username; var user = usersRealm.Get(x => x.Username == username); return(user); }
private async Task <Domain.Models.User> SaveUser(Domain.Models.User userModel, Domain.Models.Profile profileModel) { var usersRealm = new Domain.Services.Realms.Users(); var profilesRealm = new Domain.Services.Realms.Profiles(); var userLocalId = 0; var profileLocalId = profileModel.LocalId; await usersRealm.WriteAsync(realm => { realm.Manage(userModel); userModel.Profile = profilesRealm.Get(profileLocalId); userModel.ProfileId = userModel.Profile.Id; userLocalId = userModel.LocalId; userModel.Synced = true; }); var savedUser = usersRealm.Get(userLocalId); return(savedUser); }