public async Task <IActionResult> OnGetAsync(int id)
        {
            MovieServiceClient client = new MovieServiceClient(MovieServiceClient.EndpointConfiguration.NetTcpBinding_IMovieService);
            var result = await client.GetByFilterAsync(new MovieFilter { Id = id });

            if (SearchText.Length >= 1)
            {
                this.ExtraProperties = result.FirstOrDefault().MovieExtraProperties.OrderBy(x => x.PropertyName)
                                       .Where(x => x.PropertyName.ToLower().Contains(SearchText) || x.PropertyValue.ToLower().Contains(SearchText))
                                       .ToArray();
            }
            else
            {
                this.ExtraProperties = result.FirstOrDefault().MovieExtraProperties.OrderBy(x => x.PropertyName).ToArray();
            }
            await client.CloseAsync();

            return(Page());
        }
Example #2
0
        public async Task <IActionResult> OnGetAsync()
        {
            MovieServiceClient client = new MovieServiceClient(MovieServiceClient.EndpointConfiguration.NetTcpBinding_IMovieService);

            if (SearchText.Length >= 3)
            {
                DateTime dateSearch;
                try
                {
                    dateSearch = DateTime.Parse(SearchText);
                }
                catch
                {
                    dateSearch = new DateTime();
                }
                int idSearch;
                try
                {
                    idSearch = Convert.ToInt32(SearchText);
                }
                catch
                {
                    idSearch = 0;
                }
                this.Videos = (await client.GetAllAsync()).Where(x => x.Description.ToLower().Contains(SearchText) ||
                                                                 x.DateAdded == dateSearch ||
                                                                 x.Name.ToLower().Contains(SearchText) ||
                                                                 x.Path.ToLower().Contains(SearchText) ||
                                                                 x.PathChanged.ToString() == SearchText ||
                                                                 x.Id.ToString().Contains(idSearch.ToString())).ToArray();
            }
            else
            {
                this.Videos = await client.GetAllAsync();
            }
            await client.CloseAsync();

            return(Page());
        }