public async Task <IActionResult> Delete(AmigoDeleteViewModel model) { try { var result = await _amigoService.DeleteAmigoAsync(model); if (result.Succeeded) { return(RedirectToAction("Index")); } else { ViewBag.alerts = new AlertViewModel { Type = GeneralConstants.ERROR, Text = result.Message }; model = await _amigoService.GetAmigoDeleteAsync(model.Id); return(View(model)); } } catch (Exception ex) { _logger.LogInformation(ex.Message); return(View("Error", new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier })); } }
public async Task <ActionResult> Delete(int id) { var result = await _amigoService.DeleteAmigoAsync(id); if (!result.Succeeded) { return(NotFound(result.Message)); } return(NoContent()); }