Ejemplo n.º 1
0
        public async Task <ActionResult> RemoveSheriffTraining(int id, string expiryReason)
        {
            await CheckForAccessToSheriffByLocation <SheriffTraining>(id);

            await SheriffService.RemoveSheriffTraining(id, expiryReason);

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> RemoveSheriffTraining(int id, string expiryReason)
        {
            await CheckForAccessToSheriffByLocation <SheriffTraining>(id);

            if (!User.HasPermission(Permission.RemovePastTraining))
            {
                var sheriffTraining = Db.SheriffTraining.AsNoTracking().FirstOrDefault(st => st.Id == id);
                if (sheriffTraining?.EndDate <= DateTimeOffset.UtcNow)
                {
                    throw new BusinessLayerException("No permission to remove training that has completed.");
                }
            }

            await SheriffService.RemoveSheriffTraining(id, expiryReason);

            return(NoContent());
        }
        public async Task <ActionResult> RemoveSheriffTraining(int id)
        {
            await _service.RemoveSheriffTraining(id);

            return(NoContent());
        }