Example #1
0
        public ActionResult PostDeleteSearch(Guid searchId)
        {
            // Used to 'unsubscribe' from an anonymous user's alert.

            var model = new DeleteSearchModel();

            try
            {
                model.Search = GetSearch(searchId);

                // Given that an anonymous user could be responding to an email alert on different devices
                // and that they don't have to sign in get the owner directly from the search itself.

                var owner = _anonymousUsersQuery.GetContact(model.Search.OwnerId);
                if (owner == null)
                {
                    throw new ValidationErrorsException(new NotFoundValidationError("alert id", searchId));
                }

                // Delete it.

                _jobAdSearchAlertsCommand.DeleteJobAdSearch(owner.Id, searchId);
                model.HasDeleted = true;

                ModelState.AddModelConfirmation("You have now been unsubscribed from this job alert.");
                return(View(model));
            }
            catch (UserException ex)
            {
                ModelState.AddModelError(ex, new StandardErrorHandler());
            }

            return(View(model));
        }
Example #2
0
        public ActionResult DeleteSearch(Guid searchId)
        {
            var model = new DeleteSearchModel();

            try
            {
                model.Search = GetSearch(searchId);
            }
            catch (UserException ex)
            {
                ModelState.AddModelError(ex, new StandardErrorHandler());
            }

            return(View(model));
        }