Beispiel #1
0
        public ActionResult AddCandidates(Guid folderId, Guid[] candidateIds)
        {
            try
            {
                // Look for the folder.

                var employer = CurrentEmployer;
                var folder   = _candidateFoldersQuery.GetFolder(employer, folderId);
                if (folder == null)
                {
                    return(JsonNotFound("folder"));
                }

                // Add candidates.

                var count = _candidateListsCommand.AddCandidatesToFolder(employer, folder, candidateIds);
                return(Json(new JsonListCountModel {
                    Id = folderId, Count = count
                }));
            }
            catch (UserException ex)
            {
                ModelState.AddModelError(ex, new StandardErrorHandler());
            }

            return(Json(new JsonResponseModel()));
        }
Beispiel #2
0
        private FolderListModel FolderResults(Guid folderId, MemberSearchSortCriteria sortCriteria, CandidatesPresentationModel presentation)
        {
            var employer = CurrentEmployer;
            var folder   = _candidateFoldersQuery.GetFolder(employer, folderId);

            if (folder == null)
            {
                return(null);
            }

            // Do a search to get the candidates in this folder.

            var model = Search(employer, folderId, sortCriteria, presentation);

            model.Folder     = folder;
            model.FolderData = new FolderDataModel
            {
                Count     = model.Results.TotalCandidates,
                CanDelete = _candidateFoldersCommand.CanDeleteFolder(employer, folder),
                CanRename = _candidateFoldersCommand.CanRenameFolder(employer, folder),
            };
            model.SortOrders    = SortOrders;
            model.Communities   = _communitiesQuery.GetCommunities().ToDictionary(c => c.Id, c => c);
            model.Verticals     = _verticalsQuery.GetVerticals().ToDictionary(v => v.Id, v => v);
            model.CurrentSearch = EmployerContext.CurrentSearch;

            return(model);
        }
Beispiel #3
0
        public AjaxResult SetFolderName(string folderIdStr, string newName)
        {
            if (string.IsNullOrEmpty(folderIdStr))
            {
                throw new ArgumentException("The folder ID must be specified.", "folderIdStr");
            }

            try
            {
                EnsureEmployerLoggedIn();

                var folder = _candidateFoldersQuery.GetFolder(LoggedInEmployer, new Guid(folderIdStr));
                _candidateFoldersCommand.RenameFolder(LoggedInEmployer, folder, newName);
                return(new AjaxResult(AjaxResultCode.SUCCESS));
            }
            catch (Exception ex)
            {
                return(HandleException(ex));
            }
        }