protected async Task ConfirmDeleteDrug(bool deletedConfirmed)
        {
            if (deletedConfirmed)
            {
                await DrugsDataService.DeleteDrug(drug.Id);

                await OnDrugDeleted.InvokeAsync(true);

                StatusClass = "alert-success";
                Message     = "Deleted successfully";
                Saved       = true;
            }
        }
Exemple #2
0
        protected async Task HandleValidSubmit()
        {
            var addedDrug = await DrugsDataService.AddDrug(drug);

            if (addedDrug != null)
            {
                StatusClass = "alert-success";
                Message     = "New drug added successfully.";
                Saved       = true;
            }
            else
            {
                StatusClass = "alert-danger";
                Message     = "Something went wrong adding the new employee. Please try again.";
                Saved       = false;
            }
        }
        protected async Task HandleValidSubmit()
        {
            drug.Id = int.Parse(Id);
            await DrugsDataService.UpdateDrug(drug);

            try
            {
                StatusClass = "alert-success";
                Message     = "Drug updated successfully.";
                Saved       = true;
            }
            catch (Exception)
            {
                StatusClass = "alert-danger";
                Message     = "Something went wrong adding the new drug. Please try again.";
                Saved       = false;
            }
        }
 protected override async Task OnInitializedAsync()
 {
     Saved = false;
     drug  = await DrugsDataService.GetDrugDetails(int.Parse(Id));
 }
Exemple #5
0
 protected async override Task OnInitializedAsync()
 {
     drug = await DrugsDataService.GetDrugDetails(int.Parse(Id));
 }