public async Task <IActionResult> FindEvents(int page = 1) { var Date = await FEventServices.GetAllEventAsync(); var Obj = new WebEvento.ViewModel.InformationViewModel(); Obj.EventList = Date.ToList(); var dt2 = DateTime.Now; foreach (var item in Obj.EventList) { var dt = item.EventNow.Date; TimeSpan ts = (dt2 - dt); Obj.PeriodEventTime = new List <string>(); Obj.PeriodEventTime.Add(ts.ToString(@"hh\:mm\:ss")); } var totalNumberInCollection = Obj.EventList.Count; var itemsPerPage = 5; ViewBag.PaginatedMeta = _paginatedMetaService.GetMetaData(totalNumberInCollection, page, itemsPerPage); return(View(Obj)); }
/// <summary> /// رویدادهای منتشر شده /// </summary> /// <returns></returns> public async Task <IActionResult> PublishEvent() { var PublishEvent = await FEventServices.GetAllEventAsync(); var Date = PublishEvent.Where(x => x.Statusevent == Event.StatuseEvent.Published); if (Date.Any()) { var dt2 = DateTime.Now; vmodel.EventList = Date.ToList(); vmodel.PeriodEventTime = new List <string>(); foreach (var item in vmodel.EventList) { var dt = item.EventNow.Date; TimeSpan ts = (dt2 - dt); vmodel.PeriodEventTime.Add(ts.ToString(@"hh\:mm\:ss")); } vmodel.EventList = Date.ToList(); ViewBag.Error = true; if (vmodel.EventList.Count < 0) { ViewBag.Count = 0; } if (vmodel.EventList.Count > 0) { ViewBag.Count = vmodel.EventList.Count; } return(View(vmodel)); } ViewBag.Error = false; return(View()); }