public void PrepareData(EventsContext context, IEnumerable <DomainEvent> events) { if (events != null && events.Count() > 0) { var eventsWrapped = events.Select(ev => EventWrapper.Wrap(ev)).ToArray(); context.AddRange(eventsWrapped); context.SaveChanges(); } }
public async Task AddToDb(EventCallbackModel eventCallback) { foreach (EventModel em in eventCallback.events) { if (em.objectType == "cell") { em.cellValue = _smartsheetService.GetCellValue(eventCallback.scopeObjectId, em.rowId.Value, em.columnId.Value); } } _context.AddRange(eventCallback); await _context.SaveChangesAsync(); }