protected override async Task OnInitializedAsync()
        {
            int.TryParse(QuizeId, out var quizeId);

            if (quizeId == 0) //new Quize is being created
            {
                //add some defaults
                Quize = new QuizeViewModel {
                    Id = 0
                };
            }
            else
            {
                Quize = await QuizeService.GetById(quizeId);
            }
        }
        protected async Task HandleValidSubmit()
        {
            Saved = false;

            if (Quize.Id == 0) //new
            {
                var addedQuize = await QuizeService.Create(Quize);

                if (addedQuize != null)
                {
                    //StatusClass = "alert-success";
                    //Message = "New Quize added successfully.";
                    Saved = true;
                    if (addedQuize?.Id > 0)
                    {
                        Quize = addedQuize;
                        NavigateToOverview();
                    }
                }
                else
                {
                    StatusClass = "alert-danger";
                    Message     = "Something went wrong adding the new Quize. Please try again.";
                    Saved       = false;
                }
            }
            else
            {
                await QuizeService.Update(Quize);

                //StatusClass = "alert-success";
                //Message = "Quize updated successfully.";
                Saved = true;
                NavigateToOverview();
            }
        }
 protected override async Task OnInitializedAsync()
 {
     Quize = await QuizeService.GetById(QuizeId);
 }
Esempio n. 4
0
 protected override async Task OnInitializedAsync()
 {
     Quize = await QuizeService.GetById(Convert.ToInt64(QuizeId));
 }
Esempio n. 5
0
 protected override async Task OnInitializedAsync()
 {
     Quizes = await QuizeService.GetAll();
 }