public async Task <string> UpdateTerrestrialRound(string stattionId, RoundParams round) { var filter = Builders <Station> .Filter.Eq(s => s._id, stattionId); var update = Builders <Station> .Update.Set(s => s.TerrestrialRounds[round.ID], round); await _MongoCollectionStations.UpdateOneAsync(filter, update); return(round.ID); }
public async Task <bool> ProcessStationRecord(string stationId, string roundId) { var station = await _LoadSaveRepo.LoadStationAsync(stationId); if (station == null) { var rounds = await _LoadSaveRepo.LoadRoundsByStationIdAsync(stationId); Station nstation = new Station() { _id = stationId, PointId = rounds[0].Station.PointId, Position = rounds[0].Station.Position, ReferenceRound = roundId, TerrestrialRounds = new Dictionary <string, RoundParams>(), Targets = new Dictionary <string, TargetParams>() }; foreach (var round in rounds) { RoundParams roundParams = new RoundParams() { ID = round._id, RoundStartUtc = round.RoundStartUtc, RoundEndUtc = round.RoundEndUtc, FlaggedObs = new List <string>() }; nstation.TerrestrialRounds.Add(round._id, roundParams); } await _LoadSaveRepo.SaveNewStationAsync(nstation); } else { if (!station.TerrestrialRounds.ContainsKey(roundId)) { TerrestrialRound round = await _LoadSaveRepo.LoadSingleRoundAsync(roundId); RoundParams roundParams = new RoundParams() { ID = roundId, RoundStartUtc = round.RoundStartUtc, RoundEndUtc = round.RoundEndUtc, FlaggedObs = new List <string>() }; station.TerrestrialRounds.Add(roundId, roundParams); await _LoadSaveRepo.UpdateStationRoundListAsync(station._id, station.TerrestrialRounds); } } return(true); }
static double AddValue(RoundParams r) //добавление значения { Console.WriteLine(r + ":"); string value = Console.ReadLine(); try { return(int.Parse(value)); } catch { Console.WriteLine("Введенные данные не являются числом. Повторите ввод"); return(AddValue(r)); } }