public async Task <ActionResult> PutRange(ModelList <IndicateurMesure> model) { try { _context.IndicateurMesures.RemoveRange(model.modelsToDelete); await _context.IndicateurMesures.AddRangeAsync(model.modelsToAdd); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException ex) { return(Ok(new { message = ex.Message })); } return(Ok()); }
public virtual async Task <ActionResult> PostMulti(ModelList <T> model) { try { _context.Set <T>().RemoveRange(model.modelsToDelete); await _context.Set <T>().AddRangeAsync(model.modelsToAdd); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException ex) { return(Ok(new { message = ex.Message })); } return(Ok()); }