Skip to content

Instantly share code, notes, and snippets.

@carlwoodhouse
Last active December 11, 2015 15:41
Show Gist options
  • Select an option

  • Save carlwoodhouse/16631a7ed67ecb99deaa to your computer and use it in GitHub Desktop.

Select an option

Save carlwoodhouse/16631a7ed67ecb99deaa to your computer and use it in GitHub Desktop.
var events = _cacheManager.Get("a.magic.key", ctx => {
ctx.Monitor(_signals.When(TimeSpan.FromHours(1));
var myEvents = new List<evento>();
if (menus != null) {
var menuIds = menus.Select(x => x.MenuTypePartRecord.Id).ToList();
var eventRecords = _contentManager.Query<ReservationPart, ReservationPartRecord>().Where(x => x.Name == user && menuIds.Contains(x.Record.MenuTypePartRecord.Id).ToList();
foreach (var menu in menus)
{
var reserva = Record.MenuTypePartRecord.Id.Where(item => item.Date == menu.Record.Date).FirstOrDefault();
var eventDate = menu.Record.Date.Value;
var evento = new evento {
id = reserva != null ? reserva.Id.ToString() : menu.Id.ToString(),
title = menu.MenuTypePartRecord.Name,
start = Year + "-" + eventDate.Month + "-" + eventDate.Day
color = reserva != null ? "#ef4630" : eventDate <= datenow ? "#cccccc" : "#69ba00";
allDay = true
};
myEvents.Add(evento);
}
}
return myEvents;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment