private async Task <Domain.Models.Profile> SaveProfile(Domain.Models.Profile profile) { var profilesRealm = new Domain.Services.Realms.Profiles(); var profileLocalId = 0; await profilesRealm.WriteAsync(realm => { realm.Manage(profile); profileLocalId = profile.LocalId; profile.Synced = true; }); var savedProfile = profilesRealm.Get(profileLocalId); return(savedProfile); }
public sealed override void RefreshData() { #if DEBUG_UI ProfileModel = new Domain.Models.Profile { FirstName = "Brandon", LastName = "Keyes", Email = "*****@*****.**", PhoneNumber = "6137095799", StartDate = DateTimeOffset.Now, Level = "Blue" }; #else ProfileModel = ProfilesRealm.Get(ProfileId); #endif }
public override void RefreshData() { var profilesRealm = new Domain.Services.Realms.Profiles(); ProfileModel = profilesRealm.Get(ProfileLocalId); var membersRealm = new Domain.Services.Realms.Members(); var member = membersRealm.Get(x => x.Profile == ProfileModel); var evals = EvaluationsRealm.GetAll(x => x.Member == member).ToList(); var evalsContainer = new List <ViewModels.Controls.PrettyListViewItems.Evaluation>(); foreach (var evalModel in evals) { evalsContainer.Add(new ViewModels.Controls.PrettyListViewItems.Evaluation(evalModel)); } EvaluationsList.Clear(); EvaluationsList.AddRange(evalsContainer); }
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); }
private async Task <Domain.Models.Member> SaveMember(Domain.Models.Member memberModel, Domain.Models.School school, Domain.Models.Profile profile) { var membersRealm = new Domain.Services.Realms.Members(); var profilesRealm = new Domain.Services.Realms.Profiles(); var schoolsRealm = new Domain.Services.Realms.Schools(); var profileLocalId = profile.LocalId; var schoolLocalId = school.LocalId; var memberLocalId = 0; await membersRealm.WriteAsync(realm => { realm.Manage(memberModel); memberLocalId = memberModel.LocalId; memberModel.Profile = profilesRealm.Get(profileLocalId); memberModel.School = schoolsRealm.Get(schoolLocalId); memberModel.Synced = true; }); var member = membersRealm.Get(memberLocalId); return(member); }
public Master() { var isTeacher = GetCurrentMember().IsTeacher; ProfileModel = ProfilesRealm.Get(GetCurrentUser().Profile.LocalId); ItemsList.Add(new MasterItem { Title = "My classes", IconSource = "myclasses.png", TargetType = typeof(Views.Pages.Calendar) }); ItemsList.Add(new MasterItem { Title = "Schedule", IconSource = "schedule.png", TargetType = typeof(Views.Pages.Classes) }); if (!isTeacher) { ItemsList.Add(new MasterItem { Title = "Evaluations", IconSource = "evaluations.png", TargetType = typeof(Views.Pages.Evaluations) }); } ItemsList.Add(new MasterItem { Title = "Students", IconSource = "students.png", TargetType = typeof(Views.Pages.Students) }); ItemsList.Add(new MasterItem { Title = "School", IconSource = "school.png", TargetType = typeof(Views.Pages.Details.School) }); }