public async Task <ActivityLogViewViewModel> FindAllInfoById(int id) { ActivityLogModel activityLogModel = await FindById(id); if (activityLogModel == null) { return(null); } ActivityLogViewViewModel viewModel = new ActivityLogViewViewModel(); viewModel.ActivityLog = activityLogModel; viewModel.Participants = await ActivityLogPersonRepository.FindActivityParticipants(id); viewModel.CreatedBy = await UserRepository.GetUser(activityLogModel.CreatedBy); viewModel.HasDocuments = (await DocumentRepository.GetActivityLogDocumentsList(id)).Any(); return(viewModel); }
public async Task <ActivityLogViewViewModel> FindByTitle(string title) { if (string.IsNullOrWhiteSpace(title)) { return(null); } ActivityLogModel activityLogModel = await ActivityLogRepository.GetActivityByTitle(title); if (activityLogModel == null) { return(null); } ActivityLogViewViewModel viewModel = new ActivityLogViewViewModel(); viewModel.ActivityLog = activityLogModel; viewModel.CreatedBy = await UserRepository.GetUser(activityLogModel.CreatedBy); return(viewModel); }
public async Task <ActionResult> View(int id) { MiniProfiler profiler = MiniProfiler.Current; ActivityLogViewViewModel activity = null; using (profiler.Step("Get activity")) { activity = await ActivityService.FindAllInfoById(id); } if (activity == null) { string message = string.Format("Activity Log ID {0} not found", id); MvcApplication.LogException(new ArgumentException(message, nameof(id))); return(RedirectToAction("NotFound", "Error")); } using (profiler.Step("Get all label types")) { ViewBag.TypeLabels = ActivityService.GetActivityTypeLabels(); } return(View(activity)); }