public bool UpdateBulkListCustomersCessation(List <CustomerCessationUpdate> customer) { using (var transac = _OTRSContext.Database.BeginTransaction()) { bool result; try { foreach (var item in customer) { var obj = _OTRSContext.CustomerUser.Find(item.IdUser); obj.DateEndcontrat = item.DateEndcontrat; _OTRSContext.SaveChanges(); } transac.Commit(); result = true; } catch (Exception ex) { var message = ex.Message; transac.Rollback(); result = false; } return(result); } }
public async Task <bool> UpdateAssetByStolen(string assetId) { bool result; var obj = await _OTRSContext.CmdbCpu.FindAsync(assetId); obj.DeploymentState = _OTRSOpions.AssetDeploymentStateStolen; obj.Comentario = _OTRSOpions.AssetDeploymentStateStolen; obj.FechaMod = DateTime.Now; if (_OTRSContext.SaveChanges() > 0) { result = true; } else { result = false; } return(result); }