Exemplo n.º 1
0
        public async Task Screening_sets_model_correctly(
            MovieDto movie,
            IFindMovieService serviceStub,
            [NoAutoProperties] MoviesController sut)
        {
            // Arrange
            Mock.Get(serviceStub)
            .Setup(x => x.FindMovie(movie.Id))
            .ReturnsAsync(movie);

            // Act
            dynamic result = await sut.Screenings(serviceStub, movie.Id);

            // Assert
            object actual = result.Model;

            actual.Should().BeOfType <ScreeningsViewModel>();
            actual.Should().BeEquivalentTo(new
            {
                MovieId    = movie.Id,
                MovieTitle = movie.Title,
                Screenings = from s in movie.Screenings
                             select ScreeningViewModel.Translate(s),
            });
        }
        public Response <ScreeningViewModel> UpdateScreening(ScreeningViewModel screening)
        {
            string apiUrl   = baseRoute + "UpdateScreening";
            var    response = communicationManager.Post <ScreeningModel, Response <ScreeningModel> >(screening.ToModel(), apiUrl);

            return(response.ToViewModel());
        }
Exemplo n.º 3
0
        public IActionResult CreateJobRequirement()
        {
            var screeningViewModel = new ScreeningViewModel();

            screeningViewModel.lstScreeningCandidates = _mapper.Map <List <ScreeningCandidateModel> > (this._context.ScreeningCandidate.ToList());
            screeningViewModel.lstJobCategories       = _mapper.Map <List <JobCategoriesModel> > (this._context.JobCategories.ToList());
            screeningViewModel.lstScreeningQuestions  = _mapper.Map <List <ScreeningQuestionsModel> >(this._context.ScreeningQuestions.ToList());
            screeningViewModel.lstTechnologyStack     = _mapper.Map <List <TechnologyStackModel> > (this._context.TechnologyStack.ToList());
            screeningViewModel.lstTechnologies        = _mapper.Map <List <TechnologiesModel> >(this._context.Technologies.ToList());
            return(View(screeningViewModel));
        }
        /// <summary>
        /// Creates the screening view model from screening.
        /// </summary>
        /// <param name="screening">The screening.</param>
        /// <param name="hallName">Name of the hall.</param>
        /// <param name="projectionTitle">The projection title.</param>
        /// <param name="noFreeSpaces">The no free spaces.</param>
        /// <returns></returns>
        private ScreeningViewModel CreateScreeningViewModelFromScreening(Screening screening, string hallName, string projectionTitle, int noFreeSpaces)
        {
            var viewModel = new ScreeningViewModel
            {
                ScreeningDateTime        = screening.ScreenStartDateTime,
                ScreeningProjectionHall  = hallName,
                ScreeningProjectionTitle = projectionTitle,
                FreeSpacesNumber         = noFreeSpaces
            };

            return(viewModel);
        }
Exemplo n.º 5
0
        public IActionResult CreateScreeningQuestions(int id)
        {
            var screeningViewModel = new ScreeningViewModel();

            var screening = this.screeningRepository.GetScreeningDetailToCreateQuestions(id);

            screeningViewModel.Screening = screening;

            TempData["ScreeningId"] = id;

            return(View(screeningViewModel));
        }
 public ActionResult EditScreening(ScreeningViewModel screening)
 {
     if (_screeningLogic.IsThisDateAndTimeAvailable(screening.HallId, screening.DateOfScreening, screening.TimeOfScreening, screening.MovieId, screening.Id))
     {
         _screeningLogic.EditScreening(_mapper.Map <ScreeningModel>(screening));
         return(RedirectToAction("ListScreenings"));
     }
     else
     {
         ModelState.AddModelError("TimeOfScreening", "Another movie is already showing in this hall at this time");
     }
     return(View(_mapper.Map <ScreeningViewModel>(_screeningLogic.GetScreeningById(screening.Id))));
 }
        public ActionResult AddScreening(ScreeningViewModel screening)
        {
            if (_screeningLogic.IsThisDateAndTimeAvailable(screening.HallId, screening.DateOfScreening, screening.TimeOfScreening, screening.MovieId, screening.Id))
            {
                _screeningLogic.AddScreening(_mapper.Map <ScreeningModel>(screening));
                return(RedirectToAction("ListScreenings"));
            }
            ModelState.AddModelError("TimeOfScreening", "Another movie is already showing in this hall at this time");

            List <ScreeningViewModel> screenings = new List <ScreeningViewModel>();

            screenings = _mapper.Map <List <ScreeningViewModel> >(_screeningLogic.GetScreenings());
            return(View(screenings[0]));
        }
Exemplo n.º 8
0
        // GET: Screening/Create
        public IActionResult Create()
        {
            ViewData["UserId"] = new SelectList(_context.User, "UserId", "UserId");

            var screeningViewModel = new ScreeningViewModel();

            screeningViewModel.lstScreeningCandidates = _mapper.Map <List <ScreeningCandidateModel> >(this._context.ScreeningCandidate.ToList());
            screeningViewModel.lstJobCategories       = _mapper.Map <List <JobCategoriesModel> >(this._context.JobCategories.ToList());
            screeningViewModel.lstScreeningQuestions  = _mapper.Map <List <ScreeningQuestionsModel> >(this._context.ScreeningQuestions.ToList());
            screeningViewModel.lstTechnologyStack     = _mapper.Map <List <TechnologyStackModel> >(this._context.TechnologyStack.ToList());
            screeningViewModel.lstTechnologies        = _mapper.Map <List <TechnologiesModel> >(this._context.Technologies.ToList());

            ViewBag.Technologies = screeningViewModel.lstTechnologies.Select(x => x.TechName).ToArray();

            return(View(screeningViewModel));
        }
        public static ScreeningModel ToModel(this ScreeningViewModel model)
        {
            if (model == null)
            {
                return(null);
            }

            var result = new ScreeningModel
            {
                ContactID                   = model.ContactID,
                ScreeningID                 = model.ScreeningID,
                ProgramID                   = model.ProgramID,
                ProgramName                 = model.ProgramName,
                InitialContactDate          = model.InitialContactDate,
                InitialServiceCoordinatorID = model.InitialServiceCoordinatorID,
                InitialServiceCoordinator   = model.InitialServiceCoordinator,
                PrimaryServiceCoordinatorID = model.PrimaryServiceCoordinatorID,
                PrimaryServiceCoordinator   = model.PrimaryServiceCoordinator,
                ScreeningDate               = model.ScreeningDate,
                ScreeningTypeID             = model.ScreeningTypeID,
                ScreeningType               = model.ScreeningType,
                AssessmentID                = model.AssessmentID,
                AssessmentName              = model.AssessmentName,
                ScreeningResultsID          = model.ScreeningResultsID,
                ScreeningResult             = model.ScreeningResult,
                ScreeningScore              = model.ScreeningScore,
                ScreeningStatusID           = model.ScreeningStatusID,
                ScreeningStatus             = model.ScreeningStatus,
                SubmittedByID               = model.SubmittedByID,
                SubmittedBy                 = model.SubmittedBy,
                ResponseID                  = model.ResponseID ?? 0,
                SectionID                   = model.SectionID ?? 0,
                ModifiedOn                  = model.ModifiedOn
            };

            return(result);
        }
Exemplo n.º 10
0
 public ActionResult BuyingTickets(ScreeningViewModel screening)
 {
     return(RedirectToAction("SeatConfirm"));
 }
Exemplo n.º 11
0
        public ActionResult SeatSelector(ScreeningViewModel screening)
        {
            var viewScreening = _mapper.Map <ScreeningViewModel>(screening);

            return(View(viewScreening));
        }
Exemplo n.º 12
0
 public ActionResult DeleteScreening(ScreeningViewModel screening)
 {
     _screeningLogic.DeleteScreening(screening.Id);
     return(RedirectToAction("ListScreenings"));
 }
 public Response <ScreeningViewModel> UpdateScreening(ScreeningViewModel screening)
 {
     return(_screeningRepository.UpdateScreening(screening));
 }
 public Response <ScreeningViewModel> AddScreening(ScreeningViewModel screening)
 {
     return(_screeningRepository.AddScreening(screening));
 }