protected Logg CreateLogDto() { var log = new Logg(); log.ID = ID ?? Guid.NewGuid().ToString(); log.JaktId = HuntId; log.Sett = Observed; // int.Parse(ObservedPickers.SingleOrDefault(h => h.Selected)?.ID ?? "0"); log.Skudd = Shots; // int.Parse(ShotsPickers.SingleOrDefault(h => h.Selected)?.ID ?? "0"); log.Treff = Hits; // int.Parse(HitsPickers.SingleOrDefault(h => h.Selected)?.ID ?? "0"); log.Dato = Date; log.Latitude = Position.Latitude.ToString(); log.Longitude = Position.Longitude.ToString(); log.Notes = Notes; log.JegerId = HuntersPickers.SingleOrDefault(h => h.Selected)?.ID; log.DogId = DogsPickers.SingleOrDefault(h => h.Selected)?.ID; log.ArtId = SpeciesPickers.SingleOrDefault(h => h.Selected)?.ID; log.Age = Age; log.ButchWeight = ButchWeight; log.Gender = Gender; log.Weather = Weather; log.WeaponType = WeaponType; log.Weight = Weight; log.Tags = Tags; return(log); }
private async Task PopulatePickers() { var jegerIds = new List <string> { _dto.JegerId }; var dogIds = new List <string> { _dto.DogId }; HuntersPickers = await _huntFactory.CreateHunterPickerItems(jegerIds, _dto.JaktId); DogsPickers = await _huntFactory.CreateDogPickerItems(dogIds, _dto.JaktId); SpeciesPickers = await _huntFactory.CreateSpeciePickerItems(_dto.ArtId); HitsPickers = new List <PickerItem>(); ShotsPickers = new List <PickerItem>(); ObservedPickers = new List <PickerItem>(); int max = 100; for (var i = 1; i <= max; i++) { HitsPickers.Add(new PickerItem { ID = i.ToString(), Title = i.ToString(), Selected = i == _dto.Treff }); ObservedPickers.Add(new PickerItem { ID = i.ToString(), Title = i.ToString(), Selected = i == _dto.Sett }); ShotsPickers.Add(new PickerItem { ID = i.ToString(), Title = i.ToString(), Selected = i == _dto.Skudd }); } ////Add custom value pickers too //HitsPickers.Add(new PickerItem //{ // ID = _dto.Treff.ToString(), // Title = _dto.Treff.ToString(), // Selected = _dto.Treff > max, // Custom = true //}); //ObservedPickers.Add(new PickerItem //{ // ID = _dto.Sett.ToString(), // Title = _dto.Sett.ToString(), // Selected = _dto.Sett > max, // Custom = true //}); //ShotsPickers.Add(new PickerItem //{ // ID = _dto.Skudd.ToString(), // Title = _dto.Skudd.ToString(), // Selected = _dto.Skudd > max, // Custom = true //}); //Add hunter and dog if (!string.IsNullOrEmpty(_dto.JegerId)) { HunterAndDog.Add(HuntersPickers.SingleOrDefault(h => h.Selected)); } if (!string.IsNullOrEmpty(_dto.DogId)) { HunterAndDog.Add(DogsPickers.SingleOrDefault(h => h.Selected)); } }