public async Task <IActionResult> DeleteAsync(CancellationToken token, params long[] ids)
        {
            _logger.LogInformation("DELETE /cinema request accepted");
            await _cinemaService.DeleteAsync(ids);

            return(NoContent());
        }
예제 #2
0
        public async Task <ActionResult> Delete([FromRoute] int Id)
        {
            await cinemaService.DeleteAsync(Id);

            logger.LogInformation("DELETE-Request is completed");
            return(RedirectToAction("Cinemas"));
        }
        public async Task <IActionResult> Delete(int cinemaId)
        {
            if (ModelState.IsValid)
            {
                var cinemaInfo = await cinemaServices.GetByIdAsync(cinemaId);

                await cinemaServices.DeleteAsync(cinemaInfo);
            }
            return(RedirectToAction("Index"));
        }
        public async Task <IActionResult> Delete([FromQuery] int cinemaId)
        {
            var cinema = await _cinemaService.GetByIdAsync(cinemaId);

            if (cinema == null)
            {
                return(NotFound());
            }

            await _cinemaService.DeleteAsync(cinemaId);

            return(RedirectToAction("Index"));
        }
예제 #5
0
        public async Task <IActionResult> Delete(CinemaDeleteViewModel dto)
        {
            try
            {
                var cinema = await cinemaService.GetByIdAsync(dto.Id);

                await cinemaService.DeleteAsync(cinema);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
예제 #6
0
        public async Task <IActionResult> Delete(int cinemaId)
        {
            var cinema = await _cinemaService.GetByIdAsync(cinemaId);

            if (cinema == null)
            {
                return(BadRequest());
            }

            await _cinemaService.DeleteAsync(cinemaId);

            //同时需要删除电影院下面的电影
            var movies = await _movieService.GetByCinemaAsync(cinemaId);

            if (movies != null && movies.Count() >= 0)
            {
                await _movieService.DeleteMovieByCinemaAsync(cinemaId);
            }

            return(RedirectToAction("Index"));
        }