Example #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Reposit reposit = db.Reposits.Find(id);

            db.Reposits.Remove(reposit);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #2
0
 public ActionResult Edit([Bind(Include = "Id,Name,Description,hasDownloads,hasIsues,htmlURL,Language,CreatedAt,UpdatedAt")] Reposit reposit)
 {
     if (ModelState.IsValid)
     {
         db.Entry(reposit).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(reposit));
 }
Example #3
0
        // GET: Reposits/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Reposit reposit = db.Reposits.Find(id);

            if (reposit == null)
            {
                return(HttpNotFound());
            }
            return(View(reposit));
        }
Example #4
0
        private void InsereObj(Reposit r, DateTime dataAgora)
        {
            Reposit reposit = new Reposit();

            reposit.CreatedAt    = r.CreatedAt;
            reposit.Description  = r.Description;
            reposit.hasDownloads = r.hasDownloads;
            reposit.hasIssues    = r.hasIssues;
            reposit.htmlURL      = r.htmlURL;
            reposit.Language     = r.Language;
            reposit.UpdatedAt    = r.UpdatedAt;
            reposit.InseridoNoBD = dataAgora;
            reposit.Stars        = r.Stars;
            reposit.Name         = r.Name;

            db.Reposits.Add(reposit);
            db.SaveChanges();
        }
Example #5
0
        /* Função que deleta os repositorios inseridos no banco, busca os repositórios de 5 linguagens com mais estrelas
         * Utilizando Api Octokit para comunicação com Api do Github
         */
        public ActionResult Atualiza()
        {
            DateTime dataAgora = DateTime.Now;

            repoCsharp     = new Reposit();
            repoJavaScript = new Reposit();
            repoArduino    = new Reposit();
            repoGroovy     = new Reposit();
            repoRuby       = new Reposit();


            var ghCliente = new GitHubClient(new ProductHeaderValue("HudsonLimaTesting"));

            ghCliente.Credentials = new Credentials(AppSettings.Settings.userName, AppSettings.Settings.password);

            Task task1 = new Task(() => ListUserReposAsync(ghCliente));

            task1.Start();

            //Deleta registros da tabela reposit
            DeleteReposits();

            while (repoCsharp.Name is null || repoJavaScript.Name is null || repoArduino.Name is null || repoGroovy.Name is null || repoRuby.Name is null) //
            {
                Thread.Sleep(1000);
            }

            InsereObj(repoCsharp, dataAgora);
            InsereObj(repoJavaScript, dataAgora);
            InsereObj(repoArduino, dataAgora);
            InsereObj(repoGroovy, dataAgora);
            InsereObj(repoRuby, dataAgora);

            TempData["Success"] = "Dados Atualizados com sucesso em " + dataAgora.ToString();
            return(RedirectToAction("Index"));
        }
Example #6
0
 public BAL(Reposit _Iobj)
 {
     Iobj = _Iobj;
 }
Example #7
0
 public BAL(Reposit obj2)
 {
     obj1 = obj2;
 }
Example #8
0
 public BAl(Reposit Iobj1)
 {
     Iobj = Iobj1;
 }
Example #9
0
 public BAL(Reposit _Iobj)
 {
 }