示例#1
0
        public async Task <List <Popular> > startCrawler()
        {
            //Default code architecture to load any html page
            var url        = "https://mangakakalot.com";
            var httpClient = new HttpClient();
            var html       = await httpClient.GetStringAsync(url);

            var htmlDocument = new HtmlDocument();

            htmlDocument.LoadHtml(html);

            //List to hold elements collected
            List <Popular> pops = new List <Popular>();

            //Variable to hold information from specified URL
            var divs = htmlDocument.DocumentNode.Descendants("div")
                       .Where(node => node.GetAttributeValue("class", "").Equals("xem-nhieu-item")).ToList();

            //Loop to collect each apparition of specified div
            foreach (var div in divs)
            {
                Popular pop = new Popular
                {
                    Title = div.Descendants("a").FirstOrDefault().ChildAttributes("Title").FirstOrDefault().Value,
                    Link  = div.Descendants("a").FirstOrDefault().ChildAttributes("href").FirstOrDefault().Value
                };
                pops.Add(pop);
            }

            return(pops);
        }
        private static void DoSomething(object state)
        {
            IMovieService movieService = InstanceFactory.GetInstance <IMovieService>();


            Popular popular = JsonParse.Get <Popular>(TmdbLinked.GetPopular(count));

            foreach (var item in popular.results)
            {
                Movie movie = movieService.Get(x => x.TmdbID == item.id);
                if (movie != null)
                {
                    SetMovie(movie, item);
                    movieService.Update(movie);
                }
                else
                {
                    var m = new Movie();
                    SetMovie(m, item);
                    movieService.Add(m);
                }
            }

            count++;
        }
        public async Task <IActionResult> Update(int?id, Popular Popular)
        {
            Popular viewPopular = _db.Populars.Include(c => c.PopularDetail).FirstOrDefault(c => c.Id == id && c.IsDeleted == false);

            if (Popular.Photo != null)
            {
                if (!Popular.Photo.IsImage())
                {
                    ModelState.AddModelError("", "Bunu yaratmaq ucun wekil tipi yarat!!!");
                    return(View(viewPopular));
                }
                if (!Popular.Photo.MaxSize(200))
                {
                    ModelState.AddModelError("", "Wekilin olcusu 200kb-dan az olmalidi!!!");
                    return(View(viewPopular));
                }

                string folder   = Path.Combine("img", "popular");
                string fileName = await Popular.Photo.SaveImgAsync(_env.WebRootPath, folder);

                Popular.Image = fileName;
            }

            Popular.IsDeleted = false;
            viewPopular.Image = Popular.Image;

            await _db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
示例#4
0
        public async Task <List <AudioFile> > GetMoreAudio(CancellationToken token, uint offset)
        {
            if (InternetService.Connected)
            {
                try
                {
                    if (firstLoading)
                    {
                        IsLoading = true;
                        Changed("IsLoading");
                    }
                    IList <IAudioFile> tracks = new List <IAudioFile>();
                    List <AudioFile>   music  = new List <AudioFile>();
                    try
                    {
                        tracks = await Popular.Tracks(20, Tracks.Count);

                        music = await MusicService.ConvertToAudioFile(tracks);
                    }
                    catch (Flurl.Http.FlurlHttpException)
                    {
                        music          = new List <AudioFile>();
                        hasMoreLoading = false;

                        await ContentDialogService.Show(new ErrorConnectContentDialog());

                        InternetService.GoToOfflineMode();
                    }

                    if (music.Count < 20)
                    {
                        hasMoreLoading = false;
                    }

                    firstLoading = false;

                    IsLoading = false;
                    Changed("IsLoading");
                    return(music);
                }catch (Exception e)
                {
                    await ContentDialogService.Show(new ExceptionDialog("Неизвестная ошибка при получении списка популярного", "Мы не смогли получить нужную нам информацию о треках", e));

                    return(new List <AudioFile>());
                }
            }
            else
            {
                hasMoreLoading = false;
                InternetService.GoToOfflineMode();
                return(new List <AudioFile>());
            }
        }
示例#5
0
        async public Task <IResult <Popular> > GetSearch(string Text, int Page = 1)
        {
            IResult <Popular> Donut = null;
            var Liste = new Popular();

            var Req = new RestRequest("arama/" + HttpUtility.UrlEncode(Text) + "?page=" + Page);
            var Res = this._HttpClient.Get(Req);

            if (Res.StatusCode != System.Net.HttpStatusCode.OK)
            {
                Donut = Result.Fail <Popular>(Res.StatusDescription);
            }
            else
            {
                TextInfo ti = CultureInfo.CurrentCulture.TextInfo;

                var Document = await Res.Content.ConvertHTML();

                var AnimelerHTMLS = Document.QuerySelectorAll(".flx-block");


                foreach (var AnimeHTML in AnimelerHTMLS)
                {
                    ShortShow ShortShow = new ShortShow();
                    ShortShow.Uri   = AnimeHTML.Attributes["data-href"].Value;
                    ShortShow.Image = AnimeHTML.QuerySelector("a>img").Attributes["src"].Value;
                    ShortShow.Name  = AnimeHTML.QuerySelector(".bar>h4").Text();
                    Regex Onlyizle = new Regex(@"(.*?) izle");

                    var TestIzle = Onlyizle.Match(ShortShow.Name.ToLower());
                    if (TestIzle.Success)
                    {
                        ShortShow.ShowName = ti.ToTitleCase(TestIzle.Groups[1].Value);
                    }
                    else
                    {
                        ShortShow.ShowName = ShortShow.Name;
                    }

                    Liste.Shows.Add(ShortShow);
                }
                var PaginationHtml = Document.QuerySelectorAll(".pagination")[0];

                Liste.Pagination.Current = Convert.ToInt32(PaginationHtml.QuerySelector(".active").Text());

                Liste.Pagination.Max = Convert.ToInt32(PaginationHtml.QuerySelectorAll("li")[PaginationHtml.QuerySelectorAll("li").Length - 2].Text());

                Donut = Result.Success(Liste);
            }

            return(Donut);
        }
        public void loadGrid()
        {
            //this function will load the data into grid
            myDAL objDAL = new myDAL();

            newarrivals.DataSource = objDAL.GetNewArrivals_DAL();
            newarrivals.DataBind();

            myDAL objDAL2 = new myDAL();

            Popular.DataSource = objDAL2.GetPopular_DAL();
            Popular.DataBind();
        }
示例#7
0
        //Sidebar partial view
        public ActionResult Sidebar()
        {
            IEnumerable <Topics> topics;

            using (ForumDBEntities entities = new ForumDBEntities())
            {
                topics                 = entities.Topics.ToList();
                ViewBag.Topics         = topics;
                ViewBag.PopularRecords = Popular.MostPopularRecords();
            }

            return(PartialView());
        }
        public IActionResult Detail(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            Popular Popular = _db.Populars.Include(c => c.PopularDetail)
                              .FirstOrDefault(c => c.IsDeleted == false && c.Id == id);

            if (Popular == null)
            {
                return(NotFound());
            }
            return(View(Popular));
        }
示例#9
0
        /// <summary>
        /// Конструктор по умолчанию.
        /// </summary>
        public AudiosViewModel(string uniqueKey, long ownerID)
            : base(uniqueKey)
        {
            _audios            = new AudiosCollection(ownerID);
            _recommendations   = new RecommendedAudiosCollection((ulong)ownerID);
            _popular           = new PopularAudiosCollection();
            _albums            = new AudioAlbumsCollection(ownerID);
            Refresh            = new RelayCommand(() => Audios.Refresh());
            RefreshAlbums      = new RelayCommand(() => Albums.Refresh());
            RefreshPopular     = new RelayCommand(() => Popular.Refresh());
            RefreshRecommended = new RelayCommand(() => Recommendations.Refresh());
            DeleteCommand      = new RelayCommand <VKAudio>(async audio =>
            {
                var request  = new Request.DeleteAudioRequest(audio.ID, audio.OwnerID);
                var response = await request.ExecuteAsync();

                if (response.Error.ErrorType == VKErrors.None)
                {
                    Audios.Remove(audio);
                }
                else
                {
                    await ServiceHelper.DialogService.ShowMessageBox("Произошла ошибка: " + response.Error.ErrorType.ToString(),
                                                                     "Не удалось удалить аудиозапись.");
                }
            });
            DownloadAudio = new RelayCommand <VKAudio>(async audio =>
            {
                var command = new VKSaverDownloadCommand();
                command.Downloads.Add(CoreHelper.GetDownload(audio));

                await command.TryExecute();
            });

#if DEBUG
            if (ViewModelBase.IsInDesignModeStatic)
            {
                for (int i = 0; i < 71; i++)
                {
                    Audios.Add(DesignDataHelper.GetAudio());
                    Recommendations.Add(DesignDataHelper.GetAudio());
                    Popular.Add(DesignDataHelper.GetAudio());
                }
            }
#endif
        }
示例#10
0
        private async void SongClickExecute(ItemClickEventArgs obj)
        {
            var track = obj.ClickedItem;

            if (track is Advert || track is ListAdvert)
            {
                return;
            }

            if (Popular.Contains(track as WebSong))
            {
                await SongSavingHelper.SaveViezTrackLevel1(track as WebSong);
            }
            else
            {
                SheetUtility.OpenEditTrackMetadataPage(track as WebSong);
            }
        }
示例#11
0
 //Create a command query to insert values in the database
 public bool SetIntoDB(Popular pop)
 {
     try
     {
         cmd             = connection.CreateCommand();
         cmd.CommandText = GetQuery();
         cmd.Parameters.AddWithValue("@Title", pop.Title);
         cmd.Parameters.AddWithValue("@Link", pop.Link);
         cmd.Parameters.AddWithValue("@Date", DateTime.Today.ToString("dd/MM/yyyy"));
         cmd.ExecuteNonQuery();
         state = true;
     }catch (Exception e)
     {
         Console.WriteLine("Error on access to database: " + e.Message);
         state = false;
     }
     return(state);
 }
示例#12
0
        public GetDateTimeContent(
            WebSite webSite,
            Popular popular,
            DateTime dateTime,
            Action <DateTime> action,
            TimeSpan timeOut,
            int maxSize,
            int poolCount) : base(webSite,
                                  timeOut,
                                  maxSize,
                                  poolCount)
        {
            if (popular == Popular.Pages)
            {
                throw new ArgumentException("应该是按日期");
            }

            m_popular = popular;

            m_dateTime = dateTime;

            m_action = action;
        }
示例#13
0
        // POPULAR LOGIN

        public async Task <IActionResult> PopularLogin()
        {
            ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()).ToList();
            var user = new IdentityUser {
                UserName = Email, Email = Email
            };
            var result = await _userManager.CreateAsync(user, Password);

            _logger.LogInformation("User created a new account with password.");

            var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);

            code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));

            Popular pop = new Popular();

            pop.ClaimCont = "Login";
            pop.ValueCont = true;

            database.popular.Add(pop);
            database.SaveChanges();

            return(RedirectToAction("Index", "Home"));
        }
示例#14
0
        public async Task LoadDataForAlbumAndTracks(int count = 5)
        {
            Popular     = new ObservableCollection <Base>();
            NewReleases = new ObservableCollection <Base>();
            TopAlbums   = new ObservableCollection <Base>();

            try
            {
                var o = await _misc.GetTopTracksAsync(count);//GetNewRelesedSong(count);

                if (o != null && o.Songs.Count > 0)
                {
                    int indexToAdd = -1;
                    foreach (var oSong in o.Songs)
                    {
                        indexToAdd++;
                        Popular.Add(oSong);
                        if (indexToAdd == 2 || indexToAdd == 10 || indexToAdd == 22 || indexToAdd == 34 || indexToAdd == 49 ||
                            indexToAdd == 63 || indexToAdd == 78 || indexToAdd == 88 || indexToAdd == 99)
                        {
                            Popular.Insert(indexToAdd, new Advert());
                        }
                    }
                }
                else
                {
                    Popular = new ObservableCollection <Base>();
                }

                if (o != null)
                {
                    o = null;
                }

                if (Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily != "Windows.Mobile")
                {
                    SmallPopular = Popular.Take(3).ToList();
                }
                loadedCount++;
            }
            catch
            {
                //ignored
            }

            await Task.Delay(50);

            try
            {
                var newR = await _misc.GetNewRelesedSong(count);

                if (newR != null && newR.Count > 0)
                {
                    int indexToAdd = -1;
                    foreach (var oSong in newR)
                    {
                        indexToAdd++;
                        NewReleases.Add(oSong);
                        if (indexToAdd == 2 || indexToAdd == 10 || indexToAdd == 22 || indexToAdd == 34 || indexToAdd == 49 ||
                            indexToAdd == 63 || indexToAdd == 78 || indexToAdd == 88 || indexToAdd == 99)
                        {
                            NewReleases.Insert(indexToAdd, new ListAdvert());
                        }
                    }
                }

                else
                {
                    NewReleases = new ObservableCollection <Base>();
                }

                if (newR != null)
                {
                    newR = null;
                }

                loadedCount++;
            }
            catch
            {
                //ignored
            }

            try
            {
                var o = await _misc.GetTopAlbumsAsync(count);

                if (o != null && o.Albums != null && o.Albums.Count > 0)
                {
                    int indexToAdd = -1;
                    foreach (var oAlbum in o.Albums)
                    {
                        indexToAdd++;
                        TopAlbums.Add(oAlbum);
                        if (indexToAdd == 2 || indexToAdd == 10 || indexToAdd == 22 || indexToAdd == 34 || indexToAdd == 49 ||
                            indexToAdd == 63 || indexToAdd == 78 || indexToAdd == 88 || indexToAdd == 99)
                        {
                            TopAlbums.Insert(indexToAdd, new Advert());
                        }
                    }
                }
                else
                {
                    TopAlbums = new ObservableCollection <Base>();
                }


                if (o != null)
                {
                    o = null;
                }

                if (Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily != "Windows.Mobile")
                {
                    SmallTopAlbums = TopAlbums.Take(3).ToList();
                }

                loadedCount++;
            }

            catch
            {
                //ignored
            }
        }
示例#15
0
 private void pop_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
 {
     _popwebClient.DownloadStringCompleted -= pop_DownloadStringCompleted;
     if (e == null && isLoading)
     {
         MessageBox.Show("Seems like the internet connection is down or the website refused the request.\n:(\nWe are sad too that you couldnt continue.", "Error", MessageBoxButton.OK);
         isLoading = false;
         return; //TODO: give a error here
     }
     string json = e.Result;
     if (!string.IsNullOrEmpty(json))
     {
         pop = JsonConvert.DeserializeObject<Popular>(json);
         foreach (var v in pop.results)
             PopularMovies.Add(v);
         popularisLoading = false;
         isLoadingCheck();
     }
 }
示例#16
0
 public bool Add(Popular obj)
 {
     return(database.ExecuteNonQuery("AddPopular", obj.Id, obj.Position) > 0);
 }
示例#17
0
 public bool Edit(Popular obj)
 {
     return(database.ExecuteNonQuery("EditPopular", obj.Id, obj.Position) > 0);
 }
示例#18
0
        protected override void Seed(CoreDbContext db)
        {
            if (!db.Set <Popular>().Any())
            {
                Popular Popular = new Popular()
                {
                    Name = KindOfTrack.Popular
                };
                Popular NotPopular = new Popular()
                {
                    Name = KindOfTrack.NoPopular
                };

                db.Set <Popular>().Add(Popular);
                db.Set <Popular>().Add(NotPopular);
                db.SaveChanges();
            }

            if (!db.Set <Novelty>().Any())
            {
                Novelty Novelty = new Novelty()
                {
                    Name = KindOfTrack.Novelty
                };
                Novelty NotNovelty = new Novelty()
                {
                    Name = KindOfTrack.NoNovelty
                };

                db.Set <Novelty>().Add(Novelty);
                db.Set <Novelty>().Add(NotNovelty);
                db.SaveChanges();
            }

            var userManager = new ApplicationUserManager(new UserStore <ApplicationUser>(db));
            var roleManager = new ApplicationRoleManager(new RoleStore <ApplicationRole>(db));

            if (!roleManager.RoleExists(TypesRoles.Admin))
            {
                var role1 = new ApplicationRole {
                    Name = TypesRoles.Admin
                };
                var role2 = new ApplicationRole {
                    Name = TypesRoles.User
                };

                roleManager.Create(role1);
                roleManager.Create(role2);

                var admin = new ApplicationUser {
                    Email = "*****@*****.**", UserName = TypesRoles.Admin, EmailConfirmed = true
                };
                string password = "******";
                var    result   = userManager.Create(admin, password);

                if (result.Succeeded)
                {
                    userManager.AddToRole(admin.Id, role1.Name);
                    userManager.AddToRole(admin.Id, role2.Name);
                }
            }

            base.Seed(db);
        }
示例#19
0
 public void RefreshFiltering()
 {
     Items.Refresh();
     Popular.Refresh();
     Recent.Refresh();
 }
示例#20
0
        public IActionResult PopularDados()
        {
            Tecnologia tec1 = new Tecnologia();

            tec1.Nome   = ".NET";
            tec1.Status = true;
            database.tecnologias.Add(tec1);
            database.SaveChanges();

            Tecnologia tec2 = new Tecnologia();

            tec2.Nome   = "Java";
            tec2.Status = true;
            database.tecnologias.Add(tec2);
            database.SaveChanges();

            Tecnologia tec3 = new Tecnologia();

            tec3.Nome   = "Angular";
            tec3.Status = true;
            database.tecnologias.Add(tec3);
            database.SaveChanges();

            Tecnologia tec4 = new Tecnologia();

            tec4.Nome   = "SalesForce";
            tec4.Status = true;
            database.tecnologias.Add(tec4);
            database.SaveChanges();

            Tecnologia tec5 = new Tecnologia();

            tec5.Nome   = "Selenium";
            tec5.Status = true;
            database.tecnologias.Add(tec5);
            database.SaveChanges();

            Tecnologia tec6 = new Tecnologia();

            tec6.Nome   = "Node";
            tec6.Status = true;
            database.tecnologias.Add(tec6);
            database.SaveChanges();

            Tecnologia tec7 = new Tecnologia();

            tec7.Nome   = "React";
            tec7.Status = true;
            database.tecnologias.Add(tec7);
            database.SaveChanges();

            Tecnologia tec8 = new Tecnologia();

            tec8.Nome   = "TypeScript";
            tec8.Status = true;
            database.tecnologias.Add(tec8);
            database.SaveChanges();

            /////////////////////////////////////////////////////////////////////////////////////////////

            Gft unidade1 = new Gft();

            unidade1.Cep      = "06454-000";
            unidade1.Cidade   = "Barueri";
            unidade1.Endereco = "Alameda Rio Negro, 585 - Alphaville Industrial";
            unidade1.Estado   = "São Paulo";
            unidade1.Nome     = "Alphaville";
            unidade1.Telefone = "(11) 2176-3253";
            unidade1.Status   = true;
            database.gfts.Add(unidade1);
            database.SaveChanges();

            Gft unidade2 = new Gft();

            unidade2.Cep      = "80250-210";
            unidade2.Cidade   = "Curitiba";
            unidade2.Endereco = "Av. Sete de Setembro, 2451 - Rebouças";
            unidade2.Estado   = "Paraná";
            unidade2.Nome     = "Curitiba";
            unidade2.Telefone = "(41) 4009-5700";
            unidade2.Status   = true;
            database.gfts.Add(unidade2);
            database.SaveChanges();

            Gft unidade3 = new Gft();

            unidade3.Cep      = "18095-450";
            unidade3.Cidade   = "Sorocaba";
            unidade3.Endereco = "Av. São Francisco, 98 - Jardim Santa Rosália";
            unidade3.Estado   = "São Paulo";
            unidade3.Nome     = "Sorocaba";
            unidade3.Telefone = "(11) 2176-3253";
            unidade3.Status   = true;
            database.gfts.Add(unidade3);
            database.SaveChanges();

            /////////////////////////////////////////////////////////////////////////////////////////////

            Vaga vaga1 = new Vaga();

            vaga1.CodVaga       = "#ITAUNI";
            vaga1.Projeto       = "Itaú Unibanco";
            vaga1.QtdVaga       = 10;
            vaga1.AberturaVaga  = DateTime.Now;
            vaga1.DescricaoVaga = "Vagas para desenvolvedor backend .NET";
            vaga1.Status        = true;
            database.vagas.Add(vaga1);
            database.SaveChanges();

            VagaTecnologia vt1 = new VagaTecnologia();

            vt1.Vaga       = database.vagas.First(v => v.Id == vaga1.Id);
            vt1.Tecnologia = database.tecnologias.First(t => t.Id == 1);
            database.vagastecnologias.Add(vt1);
            database.SaveChanges();

            VagaTecnologia vt11 = new VagaTecnologia();

            vt11.Vaga       = database.vagas.First(v => v.Id == vaga1.Id);
            vt11.Tecnologia = database.tecnologias.First(t => t.Id == 3);
            database.vagastecnologias.Add(vt11);
            database.SaveChanges();

            Vaga vaga2 = new Vaga();

            vaga2.CodVaga       = "#RABANK";
            vaga2.Projeto       = "Rabo Bank";
            vaga2.QtdVaga       = 5;
            vaga2.AberturaVaga  = DateTime.Now;
            vaga2.DescricaoVaga = "Vagas para desenvolvedor frontend";
            vaga2.Status        = true;
            database.vagas.Add(vaga2);
            database.SaveChanges();

            VagaTecnologia vt2 = new VagaTecnologia();

            vt2.Vaga       = database.vagas.First(v => v.Id == vaga2.Id);
            vt2.Tecnologia = database.tecnologias.First(t => t.Id == 3);
            database.vagastecnologias.Add(vt2);
            database.SaveChanges();

            Vaga vaga3 = new Vaga();

            vaga3.CodVaga       = "#BANORI";
            vaga3.Projeto       = "Banco Original";
            vaga3.QtdVaga       = 15;
            vaga3.AberturaVaga  = DateTime.Now;
            vaga3.DescricaoVaga = "Vagas para QA";
            vaga3.Status        = true;
            database.vagas.Add(vaga3);
            database.SaveChanges();

            VagaTecnologia vt3 = new VagaTecnologia();

            vt3.Vaga       = database.vagas.First(v => v.Id == vaga3.Id);
            vt3.Tecnologia = database.tecnologias.First(t => t.Id == 5);
            database.vagastecnologias.Add(vt3);
            database.SaveChanges();

            VagaTecnologia vt31 = new VagaTecnologia();

            vt31.Vaga       = database.vagas.First(v => v.Id == vaga3.Id);
            vt31.Tecnologia = database.tecnologias.First(t => t.Id == 2);
            database.vagastecnologias.Add(vt31);
            database.SaveChanges();

            Vaga vaga4 = new Vaga();

            vaga4.CodVaga       = "#SULAME";
            vaga4.Projeto       = "Sul Ámerica";
            vaga4.QtdVaga       = 8;
            vaga4.AberturaVaga  = DateTime.Now;
            vaga4.DescricaoVaga = "Vagas para desenvolvedor SalesForce";
            vaga4.Status        = true;
            database.vagas.Add(vaga4);
            database.SaveChanges();

            VagaTecnologia vt4 = new VagaTecnologia();

            vt4.Vaga       = database.vagas.First(v => v.Id == vaga4.Id);
            vt4.Tecnologia = database.tecnologias.First(t => t.Id == 6);
            database.vagastecnologias.Add(vt4);
            database.SaveChanges();

            VagaTecnologia vt41 = new VagaTecnologia();

            vt41.Vaga       = database.vagas.First(v => v.Id == vaga4.Id);
            vt41.Tecnologia = database.tecnologias.First(t => t.Id == 7);
            database.vagastecnologias.Add(vt41);
            database.SaveChanges();

            VagaTecnologia vt42 = new VagaTecnologia();

            vt42.Vaga       = database.vagas.First(v => v.Id == vaga4.Id);
            vt42.Tecnologia = database.tecnologias.First(t => t.Id == 8);
            database.vagastecnologias.Add(vt42);
            database.SaveChanges();

            /////////////////////////////////////////////////////////////////////////////////////////////

            Funcionario func1 = new Funcionario();

            func1.Cargo     = "Desenvolvedor .NET";
            func1.InicioWA  = DateTime.Now;
            func1.Matricula = "1545884";
            func1.Nome      = "Fabiano Preto";
            func1.TerminoWA = DateTime.Now.AddDays(15);
            func1.Gft       = database.gfts.First(g => g.Id == 1);
            func1.Status    = true;
            database.funcionarios.Add(func1);
            database.SaveChanges();

            FuncionarioTecnologia ft1 = new FuncionarioTecnologia();

            ft1.Funcionario = database.funcionarios.First(f => f.Id == func1.Id);
            ft1.Tecnologia  = database.tecnologias.First(t => t.Id == 1);
            database.funcionariostecnologias.Add(ft1);
            database.SaveChanges();

            FuncionarioTecnologia ft11 = new FuncionarioTecnologia();

            ft11.Funcionario = database.funcionarios.First(f => f.Id == func1.Id);
            ft11.Tecnologia  = database.tecnologias.First(t => t.Id == 7);
            database.funcionariostecnologias.Add(ft11);
            database.SaveChanges();

            Funcionario func2 = new Funcionario();

            func2.Cargo     = "Desenvolvedora SalesForce";
            func2.InicioWA  = DateTime.Now;
            func2.Matricula = "1544521";
            func2.Nome      = "Ingrid Serello";
            func2.TerminoWA = DateTime.Now.AddDays(15);
            func2.Gft       = database.gfts.First(g => g.Id == 3);
            func2.Status    = true;
            database.funcionarios.Add(func2);
            database.SaveChanges();

            FuncionarioTecnologia ft2 = new FuncionarioTecnologia();

            ft2.Funcionario = database.funcionarios.First(f => f.Id == func2.Id);
            ft2.Tecnologia  = database.tecnologias.First(t => t.Id == 4);
            database.funcionariostecnologias.Add(ft2);
            database.SaveChanges();

            Funcionario func3 = new Funcionario();

            func3.Cargo     = "Desenvolvedora Frontend";
            func3.InicioWA  = DateTime.Now;
            func3.Matricula = "1684284";
            func3.Nome      = "Karine Martins";
            func3.TerminoWA = DateTime.Now.AddDays(15);
            func3.Gft       = database.gfts.First(g => g.Id == 2);
            func3.Status    = true;
            database.funcionarios.Add(func3);
            database.SaveChanges();

            FuncionarioTecnologia ft3 = new FuncionarioTecnologia();

            ft3.Funcionario = database.funcionarios.First(f => f.Id == func3.Id);
            ft3.Tecnologia  = database.tecnologias.First(t => t.Id == 3);
            database.funcionariostecnologias.Add(ft3);
            database.SaveChanges();

            FuncionarioTecnologia ft31 = new FuncionarioTecnologia();

            ft31.Funcionario = database.funcionarios.First(f => f.Id == func3.Id);
            ft31.Tecnologia  = database.tecnologias.First(t => t.Id == 8);
            database.funcionariostecnologias.Add(ft31);
            database.SaveChanges();

            Funcionario func4 = new Funcionario();

            func4.Cargo     = "Desenvolvedor Backend";
            func4.InicioWA  = DateTime.Now;
            func4.Matricula = "4523284";
            func4.Nome      = "Felipe Fernandes";
            func4.TerminoWA = DateTime.Now.AddDays(15);
            func4.Gft       = database.gfts.First(g => g.Id == 1);
            func4.Status    = true;
            database.funcionarios.Add(func4);
            database.SaveChanges();

            FuncionarioTecnologia ft4 = new FuncionarioTecnologia();

            ft4.Funcionario = database.funcionarios.First(f => f.Id == func4.Id);
            ft4.Tecnologia  = database.tecnologias.First(t => t.Id == 2);
            database.funcionariostecnologias.Add(ft4);
            database.SaveChanges();

            Funcionario func5 = new Funcionario();

            func5.Cargo     = "Desenvolvedora Backend";
            func5.InicioWA  = DateTime.Now;
            func5.Matricula = "4524952";
            func5.Nome      = "kemylly Cavalcante";
            func5.TerminoWA = DateTime.Now.AddDays(15);
            func5.Gft       = database.gfts.First(g => g.Id == 1);
            func5.Status    = true;
            database.funcionarios.Add(func5);
            database.SaveChanges();

            FuncionarioTecnologia ft5 = new FuncionarioTecnologia();

            ft5.Funcionario = database.funcionarios.First(f => f.Id == func5.Id);
            ft5.Tecnologia  = database.tecnologias.First(t => t.Id == 1);
            database.funcionariostecnologias.Add(ft5);
            database.SaveChanges();

            Funcionario func6 = new Funcionario();

            func6.Cargo     = "Desenvolvedora SalesForce";
            func6.InicioWA  = DateTime.Now;
            func6.Matricula = "4522152";
            func6.Nome      = "Samara Santos";
            func6.TerminoWA = DateTime.Now.AddDays(15);
            func6.Gft       = database.gfts.First(g => g.Id == 2);
            func6.Status    = true;
            database.funcionarios.Add(func6);
            database.SaveChanges();

            FuncionarioTecnologia ft6 = new FuncionarioTecnologia();

            ft6.Funcionario = database.funcionarios.First(f => f.Id == func6.Id);
            ft6.Tecnologia  = database.tecnologias.First(t => t.Id == 4);
            database.funcionariostecnologias.Add(ft6);
            database.SaveChanges();

            Funcionario func7 = new Funcionario();

            func7.Cargo     = "Desenvolvedor Backend";
            func7.InicioWA  = DateTime.Now;
            func7.Matricula = "4521642";
            func7.Nome      = "Matheus Ribeiro";
            func7.TerminoWA = DateTime.Now.AddDays(15);
            func7.Gft       = database.gfts.First(g => g.Id == 3);
            func7.Status    = true;
            database.funcionarios.Add(func7);
            database.SaveChanges();

            FuncionarioTecnologia ft7 = new FuncionarioTecnologia();

            ft7.Funcionario = database.funcionarios.First(f => f.Id == func7.Id);
            ft7.Tecnologia  = database.tecnologias.First(t => t.Id == 1);
            database.funcionariostecnologias.Add(ft7);
            database.SaveChanges();

            FuncionarioTecnologia ft71 = new FuncionarioTecnologia();

            ft71.Funcionario = database.funcionarios.First(f => f.Id == func7.Id);
            ft71.Tecnologia  = database.tecnologias.First(t => t.Id == 2);
            database.funcionariostecnologias.Add(ft71);
            database.SaveChanges();

            Funcionario func8 = new Funcionario();

            func8.Cargo     = "Desenvolvedor FullStack";
            func8.InicioWA  = DateTime.Now;
            func8.Matricula = "4523549";
            func8.Nome      = "João Oliveira";
            func8.TerminoWA = DateTime.Now.AddDays(15);
            func8.Gft       = database.gfts.First(g => g.Id == 1);
            func8.Status    = true;
            database.funcionarios.Add(func8);
            database.SaveChanges();

            FuncionarioTecnologia ft8 = new FuncionarioTecnologia();

            ft8.Funcionario = database.funcionarios.First(f => f.Id == func8.Id);
            ft8.Tecnologia  = database.tecnologias.First(t => t.Id == 6);
            database.funcionariostecnologias.Add(ft8);
            database.SaveChanges();

            FuncionarioTecnologia ft81 = new FuncionarioTecnologia();

            ft81.Funcionario = database.funcionarios.First(f => f.Id == func8.Id);
            ft81.Tecnologia  = database.tecnologias.First(t => t.Id == 7);
            database.funcionariostecnologias.Add(ft81);
            database.SaveChanges();

            FuncionarioTecnologia ft82 = new FuncionarioTecnologia();

            ft82.Funcionario = database.funcionarios.First(f => f.Id == func8.Id);
            ft82.Tecnologia  = database.tecnologias.First(t => t.Id == 8);
            database.funcionariostecnologias.Add(ft82);
            database.SaveChanges();

            /////////////////////////////////////////////////////////////////////////////////////////////

            Alocacao alo1 = new Alocacao();

            alo1.Id             = 0;
            alo1.InicioAlocacao = DateTime.Now;
            alo1.Vaga           = database.vagas.First(v => v.Id == 1);
            database.alocacoes.Add(alo1);
            database.SaveChanges();

            var funcio1 = database.funcionarios.First(f => f.Id == 1);

            funcio1.Alocacao = database.alocacoes.First(a => a.Id == 1);
            database.SaveChanges();

            var v1 = database.vagas.First(v => v.Id == 1);

            v1.QtdVaga = v1.QtdVaga - 1;
            database.SaveChanges();

            Alocacao alo2 = new Alocacao();

            alo2.Id             = 0;
            alo2.InicioAlocacao = DateTime.Now;
            alo2.Vaga           = database.vagas.First(v => v.Id == 4);
            database.alocacoes.Add(alo2);
            database.SaveChanges();

            var funcio2 = database.funcionarios.First(f => f.Id == 2);

            funcio2.Alocacao = database.alocacoes.First(a => a.Id == 2);
            database.SaveChanges();

            var v2 = database.vagas.First(v => v.Id == 4);

            v2.QtdVaga = v2.QtdVaga - 1;
            database.SaveChanges();

            Alocacao alo3 = new Alocacao();

            alo3.Id             = 0;
            alo3.InicioAlocacao = DateTime.Now;
            alo3.Vaga           = database.vagas.First(v => v.Id == 2);
            database.alocacoes.Add(alo3);
            database.SaveChanges();

            var funcio3 = database.funcionarios.First(f => f.Id == 3);

            funcio3.Alocacao = database.alocacoes.First(a => a.Id == 3);
            database.SaveChanges();

            var v3 = database.vagas.First(v => v.Id == 2);

            v3.QtdVaga = v3.QtdVaga - 1;
            database.SaveChanges();

            Alocacao alo4 = new Alocacao();

            alo4.Id             = 0;
            alo4.InicioAlocacao = DateTime.Now;
            alo4.Vaga           = database.vagas.First(v => v.Id == 1);
            database.alocacoes.Add(alo4);
            database.SaveChanges();

            var funcio4 = database.funcionarios.First(f => f.Id == 5);

            funcio4.Alocacao = database.alocacoes.First(a => a.Id == 4);
            database.SaveChanges();

            var v4 = database.vagas.First(v => v.Id == 1);

            v4.QtdVaga = v4.QtdVaga - 1;
            database.SaveChanges();

            /////////////////////////////////////////////////////////////////////////////////////////////

            Popular pop = new Popular();

            pop.ClaimCont = "Dados";
            pop.ValueCont = true;

            database.popular.Add(pop);
            database.SaveChanges();

            return(RedirectToAction("Index", "Adm"));
        }