public ActionResult _DeleteImageRequested(int imgId) { CImage image = context.FindPhotoById(imgId); if (image == null) { return(HttpNotFound()); } List <CEvent> eventsWithImage; eventsWithImage = (from evt in context.CEvents where evt.imgId == imgId select evt).ToList(); return(PartialView("_ImageDeleteConfirm", eventsWithImage)); }
public FileContentResult GetTodaysEventImage() { List <CEvent> events; List <CEvent> recurringEvents; CRecurringEventFilter myRecurringEventFilter; DateTime myStartParam = DateTime.Now; DateTime myEndParam = DateTime.Parse(myStartParam.ToShortDateString()).AddDays(1); events = (from evt in context.CEvents where evt.start.Value >= myStartParam && evt.end.Value <= myEndParam && evt.recurranceType == 0 select evt).ToList(); recurringEvents = (from evt in context.CEvents where evt.recurranceType > 0 && myEndParam >= evt.start.Value select evt).ToList(); if (events == null) { events = new List <CEvent>(); } myRecurringEventFilter = new CRecurringEventFilter(); events = myRecurringEventFilter.AddReurringEventsBetweenDates(myStartParam, myEndParam, myStartParam.Month, events, recurringEvents); events = events.FindAll(evt => Convert.ToDateTime(evt.start).Date == myStartParam.Date); int myEventImageId = 10;//this is the placeholder image id if (events.Count > 0) { foreach (CEvent evt in events) { if (evt.imgId != null) { myEventImageId = Convert.ToInt32(evt.imgId); break; } } } CImage myImage = context.FindPhotoById(myEventImageId); return(File(myImage.imageFile, myImage.imageMimeType)); }