public ActionResult NewScreen(TheatreViewModel tvm)
        {
            ScreenViewModel obj = new ScreenViewModel()
            {
                theatreList = db.Theatres.Where(temp => temp.CityId == tvm.theatre.CityId).ToList()
            };

            return(View(obj));
        }
        public ActionResult SelectCity()
        {
            TheatreViewModel obj = new TheatreViewModel()
            {
                cityList = db.Cities.ToList()
            };

            return(View(obj));
        }
        public ActionResult NewScreen(TheatreViewModel tvm)
        {
            var theatreList = getTheatreList();

            var filter = theatreList.Where(temp => temp.CityId == tvm.theatre.CityId).ToList();

            ScreenViewModel obj = new ScreenViewModel()
            {
                theatreList = filter
                              //  theatreList = db.Theatres.Where(temp => temp.CityId == tvm.theatre.CityId).ToList()
            };

            return(View(obj));
        }
Example #4
0
        public async Task <IActionResult> AddReviewToTheatre(TheatreViewModel theatreVM, ReviewViewModel reviewVM)
        {
            if (ModelState.IsValid)
            {
                var theatre = await _theatreService.GetTheatreAsync(theatreVM.Id);

                var review = await _reviewService.GetReviewAsync(reviewVM.Id);

                await _trServices.AddReviewAsync(theatre, review);

                // _logger.LogInformation("Review successfully added to Theatre");
                return(RedirectToAction("Details", "Theatre", new { id = theatre.Id }));
            }
            // _logger.LogError("Something went wrong ,Review was not added to theatre");
            return(View(theatreVM));
        }
Example #5
0
        public async Task <IActionResult> CreateTheatre(TheatreViewModel theatreVM)
        {
            try
            {
                var theatreModel        = _theatreVMmapper.MapFrom(theatreVM);
                var newlyCreatedTheatre = await _theatreService.CreateTheatreAsync(theatreModel);

                //_logger.LogInformation("Theatre Successfully created");
                return(RedirectToAction("Catalogue", "Theatre", new { id = newlyCreatedTheatre.Id }));
            }
            catch (Exception)
            {
                //_logger.LogError("Theatre was not created,something went wrong");
                return(RedirectToAction("Catalogue", "Theatre", new { area = "" }));
            }
        }
Example #6
0
        public async Task <IActionResult> RemoveReviewFromTheatre(TheatreViewModel theatreVM, ReviewViewModel reviewVM)
        {
            if (ModelState.IsValid)
            {
                var theatre = await _theatreService.GetTheatreAsync(theatreVM.Id);

                var review = await _reviewService.GetReviewAsync(reviewVM.Id);

                await _trServices.RemoveReviewAsync(theatre, review);

                // _logger.LogInformation("Review was successfully removed from Theatre");
                return(RedirectToAction("Details", "Theatre"));
            }
            // _logger.LogInformation("Review could not be removed something went wrong");

            return(View(theatreVM));
        }
        public static TheatreViewModel MapFromTheatre(this Theatre theatre)
        {
            var theatreListing = new TheatreViewModel
            {
                Id         = theatre.Id,
                Name       = theatre.Name,
                AboutInfo  = theatre.AboutInfo,
                Phone      = theatre.Phone,
                Location   = theatre.Location,
                CreatedOn  = theatre.CreatedOn,
                ModifiedOn = theatre.ModifiedOn,
                DeletedOn  = theatre.DeletedOn,
                IsDeleted  = theatre.IsDeleted
            };

            return(theatreListing);
        }