Exemplo n.º 1
0
        public IActionResult Index(
            string currentFilter,
            string searchParam,
            int?pageNumber)
        {
            if (searchParam != null)
            {
                pageNumber = 1;
            }
            else
            {
                searchParam = currentFilter;
            }

            ViewData["CurrentFilter"] = searchParam;

            // validation
            if (string.IsNullOrEmpty(searchParam) || string.IsNullOrWhiteSpace(searchParam))
            {
                return(View(null));
            }

            var         moviesInstance = new BLManager();
            SearchMovie movies         = moviesInstance.FindMovies(searchParam, pageNumber ?? 1);

            ViewData["TotalResults"] = movies.TotalResults;

            return(View(PaginatedList <SearchDetails> .Create(movies.Search.AsQueryable(), pageNumber ?? 1, pageSize, int.Parse(movies.TotalResults))));
        }
Exemplo n.º 2
0
        public MainWindowViewModel()
        {
            this.BLL = new BLManager();

            this.basePath         = this.BLL.BasePath;
            this.locationSelector = LocationType.None;

            this.ConfigLocationsCommand = new UpdateLocationCmd(this, ShowConfigLocationsWindow);

            this.classes     = this.BLL.GetClasses();
            this.locations   = this.BLL.GetLocations();
            this.lines       = this.BLL.GetLines();
            this.counties    = this.BLL.GetCounties();
            this.regions     = this.BLL.GetRegions();
            this.big4Regions = this.BLL.GetBig4Regions();

            this.classes.Insert(0, string.Empty);
            this.locations.Insert(0, string.Empty);
            this.lines.Insert(0, string.Empty);
            this.counties.Insert(0, string.Empty);
            this.regions.Insert(0, string.Empty);
            this.big4Regions.Insert(0, string.Empty);

            this.images =
                new ObservableCollection <ImageDescription>
            {
                this.BLL.GetImage()
            };
            //string randomImage = this.BLL.GetImage();
            ObservableCollection <ImageDescription> cls83Path           = this.BLL.GetImages("83");
            ObservableCollection <ImageDescription> cls85Path           = this.BLL.GetImages("85");
            ObservableCollection <ImageDescription> cls308Path          = this.BLL.GetImages("308");
            ObservableCollection <ImageDescription> cls309Path          = this.BLL.GetImages("309");
            ObservableCollection <ImageDescription> cls308149Path       = this.BLL.GetImages("308", "149");
            ObservableCollection <ImageDescription> ColchesterPath      = this.BLL.GetImages(LocationType.Location, "Colchester");
            ObservableCollection <ImageDescription> RubbishLocationPath = this.BLL.GetImages(LocationType.Location, "Rubbish");
            ObservableCollection <ImageDescription> FlydePath           = this.BLL.GetImages(LocationType.Line, "Fylde");
            ObservableCollection <ImageDescription> RubbishLinePath     = this.BLL.GetImages(LocationType.Line, "Rubbish");
            ObservableCollection <ImageDescription> EssexPath           = this.BLL.GetImages(LocationType.County, "Essex");
            ObservableCollection <ImageDescription> AngliaPath          = this.BLL.GetImages(LocationType.Region, "Anglia");
            ObservableCollection <ImageDescription> LnerPath            = this.BLL.GetImages(LocationType.Big4Location, "LNER");

            ObservableCollection <ImageDescription> c308ColchesterPath    = this.BLL.GetImages("308", LocationType.Location, "Colchester");
            ObservableCollection <ImageDescription> c308FlydePath         = this.BLL.GetImages("308", LocationType.Line, "Fylde");
            ObservableCollection <ImageDescription> c308EssexPath         = this.BLL.GetImages("308", LocationType.County, "Essex");
            ObservableCollection <ImageDescription> c308AngliaPath        = this.BLL.GetImages("308", LocationType.Region, "Anglia");
            ObservableCollection <ImageDescription> c308LnerPath          = this.BLL.GetImages("308", LocationType.Big4Location, "LNER");
            ObservableCollection <ImageDescription> c308993ColchesterPath = this.BLL.GetImages("308", "993", LocationType.Location, "Colchester");
            ObservableCollection <ImageDescription> c308993FlydePath      = this.BLL.GetImages("308", "993", LocationType.Line, "Fylde");
            ObservableCollection <ImageDescription> c308993EssexPath      = this.BLL.GetImages("308", "993", LocationType.County, "Essex");
            ObservableCollection <ImageDescription> c308993AngliaPath     = this.BLL.GetImages("308", "993", LocationType.Region, "Anglia");
            ObservableCollection <ImageDescription> c308993LnerPath       = this.BLL.GetImages("308", "993", LocationType.Big4Location, "LNER");
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Post(IFormCollection newFileValues)
        {
            string outPutFileName = BLManager.Convert(newFileValues);

            var memory = new MemoryStream();

            using (var stream = new FileStream(outPutFileName, FileMode.Open))
            {
                await stream.CopyToAsync(memory);
            }


            memory.Position = 0;
            return(File(memory, "application/zip", Path.GetFileName(outPutFileName)));
        }
Exemplo n.º 4
0
        public IActionResult Index(string imdbIdParam)
        {
            if (string.IsNullOrEmpty(imdbIdParam))
            {
                return(View(null));
            }

            var           moviesInstance = new BLManager();
            MovieFullInfo movie          = moviesInstance.GetMovieInfo(imdbIdParam);

            string imdbUrl = HelperMethods.GetAppConfigValue("imdbUrl");

            ViewBag.ImDbUrl = imdbUrl += movie.ImdbID;

            return(View(movie));
        }
Exemplo n.º 5
0
 /// <summary>
 /// Возвращает пару значений: имя листа и последовательность задач листа
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public static KeyValuePair <string, IEnumerable <TaskPL> > GetTasksNameOfList(int id) =>
 Mapper.Map <KeyValuePair <string, IEnumerable <TaskPL> > >(BLManager.GetTasksNameOfList(id));
Exemplo n.º 6
0
 /// <summary>
 /// Возвращает последовательность заданий из листа
 /// </summary>
 /// <param name="id">Id листа</param>
 /// <returns></returns>
 public static IEnumerable <TaskPL> GetTasksOfList(int id) => Mapper.Map <IEnumerable <TaskPL> >(BLManager.GetTasksOfList(id));
Exemplo n.º 7
0
 /// <summary>
 /// Преобразование TListBL -> TListPL
 /// </summary>
 public static TListPL GetTList(int id) => Mapper.Map <TListPL>(BLManager.ReadTList(id));
Exemplo n.º 8
0
 /// <summary>
 /// Преобразование TaskBL -> TaskPL
 /// </summary>
 public static TaskPL GetTask(int id) => Mapper.Map <TaskPL>(BLManager.ReadTask(id));