private async Task AddArchitecture() { var architecture = new ArchitectureModel( Title, CreatedYear, Country, City, Address, Square, Heigth, State, Architect.Id, Style.Id); await _architecturesManager.AddArchitecture(architecture); _customNavigationService.NavigateTo(PageKeys.ArchitectureMain); }
private static async Task FillArchitectures() { IList <ArchitectureModel> architectures = (await _architecturesManager.GetArchitectures()).ToList(); IList <Architect> architects = (await _architectsManager.GetArchitects()).ToList(); IList <Style> styles = (await _stylesManager.GetStyles()).ToList(); if (architectures != null && architectures.Any()) { return; } Random r = new Random(); int stylesIndex1 = r.Next(0, styles.Count - 1), stylesIndex2 = r.Next(0, styles.Count - 1), stylesIndex3 = r.Next(0, styles.Count - 1); int architectsIndex1 = r.Next(0, architects.Count - 1), architectsIndex2 = r.Next(0, architects.Count - 1), architectsIndex3 = r.Next(0, architects.Count - 1); await _architecturesManager.AddArchitecture(new ArchitectureModel( "Architecture1", 1432, "Ukraine", "Kharkov", "Address1", 172, 272, State.Bad, architects[architectsIndex1].Id, styles[stylesIndex1].Id)); await _architecturesManager.AddArchitecture(new ArchitectureModel( "Architecture2", 1112, "Ukraine", "Odessa", "Address2", 122, 112, State.Bad, architects[architectsIndex2].Id, styles[stylesIndex2].Id)); await _architecturesManager.AddArchitecture(new ArchitectureModel( "Architecture3", 1453, "Ukraine", "Kharkov", "Address3", 144, 254, State.Great, architects[architectsIndex3].Id, styles[stylesIndex3].Id)); await _architecturesManager.AddArchitecture(new ArchitectureModel( "Architecture4", 1112, "Ukraine", "Kiev", "Address4", 123, 343, State.Normal, architects[architectsIndex1].Id, styles[stylesIndex3].Id)); await _architecturesManager.AddArchitecture(new ArchitectureModel( "Architecture5", 1919, "Ukraine", "Kharkov", "Address5", 143, 123, State.Awful, architects[architectsIndex3].Id, styles[stylesIndex2].Id)); }