public async Task <ActionResult> DeleteConfirmedForLieu(int id) { try { Activite activite = await _applicationDbContext.Activites.FindAsync(id); BusinessRuleResult result = AssoBusinessRules.CanDelete(_applicationDbContext, activite); if (result.Success) { _applicationDbContext.Activites.Remove(activite); await _applicationDbContext.SaveChangesAsync(); return(Json(new { success = result.Success, message = result.Message })); } else { return(Json(new { success = result.Success, message = result.Message })); } } catch (DbUpdateException ex) { return(Json(new { success = false, message = "Suppression impossible. Vérifiez si des Formules sont liées." })); } }
public async Task <ActionResult> DeleteConfirmedForAdherent(int id) { try { Abonnement abonnement = await _applicationDbContext.Abonnements.FindAsync(id); BusinessRuleResult result = AssoBusinessRules.CanDelete(_applicationDbContext, abonnement); if (result.Success) { _applicationDbContext.Abonnements.Remove(abonnement); await _applicationDbContext.SaveChangesAsync(); return(Json(new { success = result.Success, message = result.Message })); } else { return(Json(new { success = result.Success, message = result.Message })); } } catch (DbUpdateException) { return(Json(new { success = false, message = "Suppression impossible. Vérifiez si des règlements sont liés." })); } }
public async Task <ActionResult> DeleteConfirmed(int id) { Activite activite = await _applicationDbContext.Activites.FindAsync(id); BusinessRuleResult result = AssoBusinessRules.CanDelete(_applicationDbContext, activite); if (result.Success) { _applicationDbContext.Activites.Remove(activite); await _applicationDbContext.SaveChangesAsync(); return(Json(new { success = result.Success, message = result.Message })); } else { return(Json(new { success = result.Success, message = result.Message })); } }