コード例 #1
0
 public async Task <IActionResult> DeletePizzaAsync(Guid id)
 {
     if (await _pizzaRepo.RemovePizzaAsync(id))
     {
         return(NoContent());
     }
     else
     {
         return(NotFound());
     }
 }
コード例 #2
0
 public async Task <IActionResult> Delete(Guid id, IFormCollection collection)
 {
     try
     {
         if (!await _pizzaRepo.RemovePizzaAsync(id))
         {
             return(BadRequest());
         }
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }