예제 #1
0
        public async Task <bool> DeleteClick(long id)
        {
            var deleteObject = new ViewModel()
            {
                Id = id
            };

            await HttpClientJsonExtensions.PostJsonAsync(Http, $"{AppState.DeleteURL}", deleteObject);

            await SetData();

            return(true);
        }
예제 #2
0
파일: Edit.Razor.cs 프로젝트: jodyunter/JUG
        public async Task <bool> CreateOrUpdateModel()
        {
            await HttpClientJsonExtensions.PostJsonAsync(Http, $"{AppState.UpdateURL}", EditObject);

            AppState.UpdateModel();

            if (EditObject.Id == 0)
            {
                EditObject = new TeamViewModel();
            }

            return(true);
        }
예제 #3
0
        protected async Task HandleInvalidSubmit()
        {
            try
            {
                var response = await HttpClientJsonExtensions.PostJsonAsync <ResponseObject <FormModel> >(Http, "api/Form", Model);

                if (response?.Data != null)
                {
                    Model = response.Data;
                    StateHasChanged();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }