Example #1
0
 public async Task <IActionResult> DeleteProdukt(int id)
 {
     try
     {
         await _produktService.Delete(id);
     }
     catch
     {
         return(NotFound());
     }
     return(Ok());
 }
Example #2
0
        public async Task <IActionResult> OnPostAsync(int produktId)
        {
            try
            {
                await _produktService.Delete(produktId);

                logger.LogDebug("Produkt er blevet Slettet");
            }
            catch (Exception ex)
            {
                logger.LogError(ex, "Error");
                return(Page());
            }

            Log.CloseAndFlush();
            return(RedirectToPage("./AdminIndex"));
        }