Example #1
0
        public async Task <IActionResult> NewWebhook(string storeId, EditWebhookViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(nameof(ModifyWebhook), viewModel));
            }

            await _Repo.CreateWebhook(CurrentStore.Id, viewModel.CreateBlob());

            TempData[WellKnownTempData.SuccessMessage] = "The webhook has been created";
            return(RedirectToAction(nameof(Webhooks), new { storeId }));
        }
Example #2
0
        public async Task <IActionResult> ModifyWebhook(string webhookId, EditWebhookViewModel viewModel)
        {
            var webhook = await _Repo.GetWebhook(CurrentStore.Id, webhookId);

            if (webhook is null)
            {
                return(NotFound());
            }

            await _Repo.UpdateWebhook(CurrentStore.Id, webhookId, viewModel.CreateBlob());

            TempData[WellKnownTempData.SuccessMessage] = "The webhook has been updated";
            return(RedirectToAction(nameof(Webhooks), new { storeId = CurrentStore.Id }));
        }