Ejemplo n.º 1
0
        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;
            }
        }
Ejemplo n.º 2
0
        protected async Task HandleValidSubmit()
        {
            var newDP = Mapper.Map <DataPointForCreationDto>(DataPoint);

            var addedDP = await DataPointDataService.CreateDataPointForQuest(QuestId, newDP);

            ShowDialog = false;

            await CloseEventCallback.InvokeAsync(true);
        }