public async Task <ActionResult> RemoveSheriffTraining(int id, string expiryReason) { await CheckForAccessToSheriffByLocation <SheriffTraining>(id); await SheriffService.RemoveSheriffTraining(id, expiryReason); return(NoContent()); }
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()); }