public virtual void Update(T entity) { using (new TimeMonitor(entity.Id)) { try { entity.LastUpdate = DateTime.Now; if (this.GetContext() != null) { entity.LastUpdatedBy = this.GetContext().UserId; } if (IsCacheReady()) { cache.Set(entity); } LogInformation("Update", entity.Id); var task = Task.Run(async() => { await collection.UpdateEntityAsync(entity); }); task.Wait(); } catch (Exception ex) { LogException(ex); return; } } }
public virtual void Update(T entity) { using (new TimeMonitor(entity.Id)) { try { if (typeof(T) != typeof(HistoryService)) { ProcessHistory(HistoryType.Update, entity.Id, JsonConvert.SerializeObject(entity), this.GetContext().UserId); } if (this.GetContext().IsUseCache&& IsCacheReady()) { cache.Set(entity); } LogInformation("Update", entity.Id); var task = Task.Run(async() => { await collection.UpdateEntityAsync(entity); }); task.Wait(); } catch (Exception ex) { LogException(ex); return; } } }