Beispiel #1
0
        public ActionResult DeleteOrganisation(string organisationId)
        {
            _deleteOrganisationCommand.Invoke(new DeleteOrganisationRequest
            {
                OrganisationId = organisationId
            });

            ConfirmationNotification("Organisation deleted successfully.");

            return(RedirectToAction("index"));
        }
Beispiel #2
0
        public ActionResult Delete(string id)
        {
            if (!Authorize())
            {
                Response.StatusCode = 401;
                return(Content("Unauthorized"));
            }

            //this does not work currently - no session set
            //TODO: consider more checks that this is an AH org
            _deleteOrganisationCommand.Invoke(new DeleteOrganisationRequest()
            {
                OrganisationId = Organisation.GetId(id)
            });

            return(new PlainJsonNetResult(new {}));
        }
        public void Execute(string ravenInstanceId)
        {
            var date          = DateTime.UtcNow.AddDays(-15).Date;
            var organisations = _session.MasterRaven.Query <OrganisationDocument, Organisations>()
                                .Where(o => o.SuspendedOnUtc <= date)
                                .Where(o => o.OrganisationStatus == OrganisationStatus.Suspended)
                                .As <Organisation>()
                                .ToList();

            if (organisations.Any())
            {
                Trace("Found {0} organisations requiring cancellation", organisations.Count);

                foreach (var organisation in organisations)
                {
                    _deleteOrganisationCommand.Invoke(new DeleteOrganisationRequest
                    {
                        OrganisationId = organisation.Id
                    });
                }
            }
        }