Пример #1
0
        public async Task <ActionResult <string> > DeleteShow(int showId)
        {
            var requestHasAdminUserClaim = User.Claims.Where(claim => claim.Type == "user" && claim.Value == "1").ToList().Count > 0;

            if (!requestHasAdminUserClaim)
            {
                return(BadRequest($"You do not have permissions delete shows."));
            }

            var showDeleted = await _repository.DeleteShow(showId).ConfigureAwait(false);

            if (!showDeleted)
            {
                return(BadRequest($"Show with id: {showId} does not exist."));
            }

            return(Ok("Show successfully deleted."));
        }
 public IActionResult Delete(int id)
 {
     ShowRepository.DeleteShow(id);
     return(RedirectToAction("List"));
 }
Пример #3
0
 public void DeleteShow(int id)
 {
     repository.DeleteShow(id);
 }