public UserDashboardViewModel GetActivitiesByDate(DateTime date) { var umbracoRepository = new UmbracoRepository(); var userDashboardViewModel = new UserDashboardViewModel(); //if this date then get first date if (date.ToString("yyyy-MM-dd") == "1987-05-10") { var userActivitiesDate = umbracoRepository.GetAvailableDates(); date = userActivitiesDate.ToArray()[0]; } var userActivities = umbracoRepository.GetUserActivities(date).ToArray(); foreach (var userActivityItem in userActivities) { var useractViewObj = new UserActivitiesViewModel(userActivityItem.Datestamp) { NodeId = userActivityItem.NodeId, LogComment = userActivityItem.LogComment, LogHeader = userActivityItem.LogHeader, Text = userActivityItem.Text, Username = userActivityItem.Username, UserTypeAlias = userActivityItem.UserTypeAlias }; userDashboardViewModel.UsersActivitiesLog.Add(useractViewObj); } return userDashboardViewModel; }
public IEnumerable<string> GetAvailableDates() { var umbracoRepository = new UmbracoRepository(); var userDashboardViewModel = new UserDashboardViewModel(); var userActivitiesDate = umbracoRepository.GetAvailableDates().ToArray(); IList<string> itemTransform = new List<string>(); foreach (DateTime date in userActivitiesDate) { itemTransform.Add(date.ToString("yyyy-MM-dd")); } return itemTransform; }