예제 #1
0
        public async Task SignUp(EventModel eventModel)
        {
            if (eventModel == null)
            {
                throw new ArgumentNullException(nameof(eventModel));
            }

            SignUpsLoading.Add(eventModel.Id);
            StateHasChanged();
            await EventApiService.SignUp(eventModel.Id);

            eventModel.SignedUpCount++;
            eventModel.SignedUp = true;
            SignUpsLoading.Remove(eventModel.Id);
            StateHasChanged();
        }
예제 #2
0
        public async Task Cancel(EventModel eventModel, bool reloadRequired = false)
        {
            if (eventModel == null)
            {
                throw new ArgumentNullException(nameof(eventModel));
            }

            SignUpsLoading.Add(eventModel.Id);
            StateHasChanged();
            await EventApiService.SignUp(eventModel.Id);

            if (reloadRequired)
            {
                SignUpsLoading.Remove(eventModel.Id);
                await Load();
            }
            else
            {
                eventModel.SignedUp = false;
                eventModel.SignedUpCount--;
                SignUpsLoading.Remove(eventModel.Id);
                StateHasChanged();
            }
        }