// GET: Project/Find public async Task <IActionResult> Find(FindProjectViewModel model) { if (model.SearchText == null) { return(View(new FindProjectViewModel { OwnerId = (await _userManager.GetUserAsync(User))?.Id, Projects = await DisplayProjectViewModel.GetViewModelsWhere(_context, p => p.Status != ProjectStatus.Hidden && p.Status != ProjectStatus.Deleted) })); } model.OwnerId = (await _userManager.GetUserAsync(User))?.Id; model.Projects = await DisplayProjectViewModel.GetViewModelsWhere(_context, p => p.Status != ProjectStatus.Hidden && p.Status != ProjectStatus.Deleted && (p.Name.Contains(model.SearchText) || p.Description.Contains(model.SearchText) || p.Goal.Contains(model.SearchText))); return(View(model)); }
// GET: Projects/Details/5 public async Task <IActionResult> Details(int?id) { if (id == null) { return(NotFound()); } List <DisplayProjectViewModel> items = await DisplayProjectViewModel.GetViewModelsWhere(_context, p => p.Id == id && p.Status != ProjectStatus.Hidden && p.Status != ProjectStatus.Deleted); if (items.Count == 0) { return(NotFound()); } DisplayProjectViewModel displayProject = items.First(); string userId = (await _userManager.GetUserAsync(User))?.Id; if (userId != null && (await _service.GetParticipant(userId, displayProject.Project.Id) != null)) { displayProject.IsUserCommitted = true; } return(View(displayProject)); }