protected override async Task OnInitializedAsync() { int.TryParse(QuestId, out var questId); int.TryParse(DataPointId, out var dataPointId); DataPoint = await DataPointDataService.GetDataPointForQuest(questId, dataPointId); }
protected async Task HandleValidSubmit() { int.TryParse(QuestId, out var questId); int.TryParse(DataPointId, out var dataPointId); if (dataPointId == 0) //new { var newDP = Mapper.Map <DataPointForCreationDto>(DataPoint); var addedDP = await DataPointDataService.CreateDataPointForQuest(questId, newDP); if (addedDP != null) { StatusClass = "alert-success"; Message = "New datapoint added successfully."; Saved = true; } else { StatusClass = "alert-danger"; Message = "Something went wrong adding the new datapoint. Please try again."; Saved = true; } } else { var newDP = Mapper.Map <DataPointForUpdateDto>(DataPoint); await DataPointDataService.UpdateDataPointForQuest(questId, dataPointId, newDP); StatusClass = "alert-success"; Message = "DataPoint updated successfully."; Saved = true; } }
protected override async Task OnInitializedAsync() { Saved = false; int.TryParse(QuestId, out var questId); int.TryParse(DataPointId, out var dataPointId); Quests = (await QuestDataService.GetAllQuests()).ToList(); if (questId == 0 || dataPointId == 0) //new quest is being created { //add some defaults DataPoint = new DataPointForUpdateDto { IsPrivate = false, IsNegative = false, TimeStamp = DateTimeOffset.Now }; } else { DataPointDto = await DataPointDataService.GetDataPointForQuest(questId, dataPointId); QuestId = DataPointDto.QuestId.ToString(); DataPoint = Mapper.Map <DataPointForUpdateDto>(DataPointDto); Title = $"Details for {DataPoint.Description}"; } }
protected async Task HandleValidSubmit() { var newDP = Mapper.Map <DataPointForCreationDto>(DataPoint); var addedDP = await DataPointDataService.CreateDataPointForQuest(QuestId, newDP); ShowDialog = false; await CloseEventCallback.InvokeAsync(true); }
protected async Task DeleteDataPoint() { int.TryParse(QuestId, out var questId); int.TryParse(DataPointId, out var dataPointId); await DataPointDataService.DeleteDataPointForQuest(questId, dataPointId); StatusClass = "alert-success"; Message = "Deleted successfully"; Saved = true; }
protected override async Task OnInitializedAsync() { int.TryParse(QuestId, out var questId); int.TryParse(DataPointId, out var dataPointId); DataPoint = await DataPointDataService.GetDataPointForQuest(questId, dataPointId); MapMarkers = new List <Marker> { new Marker { Description = $"{DataPoint.Description}", ShowPopup = false, X = DataPoint.Longitude, Y = DataPoint.Latitude, RadiusMeters = DataPoint.RadiusMeters, IsNegative = DataPoint.IsNegative, Certainty = DataPoint.Certainty } }; }
protected override async Task OnInitializedAsync() { Saved = false; int.TryParse(QuestId, out var questId); int.TryParse(DataPointId, out var dataPointId); Quests = (await QuestDataService.GetAllQuests()).ToList(); if (questId != 0) { IsEdit = true; QuestId = questId.ToString(); } if (questId == 0 || dataPointId == 0) //new datapoint is being created { //add some defaults DataPoint = new DataPointForUpdateDto { IsPrivate = false, IsNegative = false, TimeStamp = DateTimeOffset.Now }; if (questId == 0 && Quests?.Count > 0) { QuestId = Quests[0].Id.ToString(); } } else { DataPointDto = await DataPointDataService.GetDataPointForQuest(questId, dataPointId); QuestId = DataPointDto.QuestId.ToString(); DataPoint = Mapper.Map <DataPointForUpdateDto>(DataPointDto); MapMarkers = new List <Marker> { new Marker { Description = $"{DataPoint.Description}", ShowPopup = false, X = DataPoint.Longitude, Y = DataPoint.Latitude, RadiusMeters = DataPoint.RadiusMeters, IsNegative = DataPoint.IsNegative, Certainty = DataPoint.Certainty } }; Title = $"Details for {DataPoint.Description}"; } }