public static List <EventConferenceDayRecord> UpdateEventConferenceDays( IList <Tuple <DateTime, string> > importConferenceDays, IEventConferenceDayService service ) { var eventConferenceDayRecords = service.FindAllAsync().Result; var patch = new PatchDefinition <Tuple <DateTime, string>, EventConferenceDayRecord>( (source, list) => list.SingleOrDefault(a => a.Date == source.Item1) ); patch.Map(s => s.Item1, t => t.Date) .Map(s => s.Item2, t => t.Name); var diff = patch.Patch(importConferenceDays, eventConferenceDayRecords); service.ApplyPatchOperationAsync(diff).Wait(); return(diff.Where(a => a.Entity.IsDeleted == 0).Select(a => a.Entity).ToList()); }
private List <EventConferenceDayRecord> UpdateEventConferenceDays( IList <Tuple <DateTime, string> > importConferenceDays, ref int modifiedRecords ) { var eventConferenceDayRecords = _eventConferenceDayService.FindAllAsync().Result; var patch = new PatchDefinition <Tuple <DateTime, string>, EventConferenceDayRecord>( (source, list) => list.SingleOrDefault(a => a.Date == source.Item1) ); patch.Map(s => s.Item1, t => t.Date) .Map(s => s.Item2, t => t.Name); var diff = patch.Patch(importConferenceDays, eventConferenceDayRecords); _eventConferenceDayService.ApplyPatchOperationAsync(diff).Wait(); modifiedRecords += diff.Count(a => a.Action != ActionEnum.NotModified); return(diff.Where(a => a.Entity.IsDeleted == 0).Select(a => a.Entity).ToList()); }
public Task <IEnumerable <EventConferenceDayRecord> > GetEventsAsync() { return(_eventConferenceDayService.FindAllAsync()); }