예제 #1
0
        public IActionResult Edit(int cinemaId)
        {
            var cinema = _cinemaService.GetByIdAsync(cinemaId).Result;

            if (cinema == null)
            {
                return(BadRequest());
            }
            return(View(cinema));
        }
        public async Task <IActionResult> Edit(int cinemaId)
        {
            var cinema = await _cinemaService.GetByIdAsync(cinemaId);

            if (cinema == null)
            {
                return(NotFound());
            }
            ViewBag.Title = $"编辑电影院 - {cinema.Name}";

            return(View(cinema));
        }
예제 #3
0
        public async Task <IActionResult> Index(int cinemaId)
        {
            var cinema = await _cinemaService.GetByIdAsync(cinemaId);

            ViewBag.Title = $"{cinema.Name}今天上映的电影有:";
            return(View(await _movieService.GetByCinemaAsync(cinemaId)));
        }
예제 #4
0
        public async Task <ActionResult <CinemaDto> > GetCinema(int id)
        {
            var cinema = await _cinemaService.GetByIdAsync(id);

            var cinemaModel = _mapper.Map <CinemaDto>(cinema);

            return(cinemaModel);
        }
        public async Task <IActionResult> Index(int cinemaId)
        {
            var cinema = await cinemaServices.GetByIdAsync(cinemaId);

            ViewBag.Title    = $"{cinema.Name}这个电影院上映的电影有:";
            ViewBag.CinemaId = cinemaId;

            return(View(await movieServices.GetByCinemaAsync(cinemaId)));
        }
예제 #6
0
        public async Task <IActionResult> Details(Guid id)
        {
            try
            {
                var cinema = await cinemaService.GetByIdAsync(id);

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

                var result = mapper.Map <CinemaDetailsViewModel>(cinema);

                return(View(result));
            }
            catch
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
예제 #7
0
        public async Task <IActionResult> Edit(int id, Cinema model)
        {
            if (ModelState.IsValid)
            {
                var exist = await _cinemaService.GetByIdAsync(id);

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

                exist.Name     = model.Name;
                exist.Location = model.Location;
                exist.Capacity = model.Capacity;
            }

            return(RedirectToAction("Index"));
        }
예제 #8
0
        public async Task <IActionResult> Edit(int cinemaId)
        {
            var cinema = await _cinemaService.GetByIdAsync(cinemaId);

            return(View(cinema));
        }
 public async Task <IActionResult> Edit(int cinemaId)
 {
     return(View(await cinemaServices.GetByIdAsync(cinemaId)));
 }
예제 #10
0
 public async Task <IActionResult> Edit(int cinemaId)
 {
     ViewBag.Title = "修改电影院";
     return(View(await _cinemaService.GetByIdAsync(cinemaId)));
 }
예제 #11
0
 public async Task GetCinema(int id)
 {
     var cinema = await _cinemaService.GetByIdAsync(id);
 }