Ejemplo n.º 1
0
 public ActionResult Edit([Bind(Include = "Id,Nazwa")] Sezon sezon)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sezon).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(sezon));
 }
Ejemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "Id,NameProduct,Price,Photo,IdCategory,IdManufacturer")] Product product)
 {
     if (ModelState.IsValid)
     {
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.IdCategory     = new SelectList(db.Categories, "Id", "NameCategory", product.IdCategory);
     ViewBag.IdManufacturer = new SelectList(db.Table_Matufactur, "Id", "NameManufacturer", product.IdManufacturer);
     return(View(product));
 }
Ejemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "Id,Nazwa,MeczId,ZawodnikId,KlubId")] Pozycja pozycja)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pozycja).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.KlubId     = new SelectList(db.Kluby, "Id", "Nazwa", pozycja.KlubId);
     ViewBag.MeczId     = new SelectList(db.Mecze, "Id", "Id", pozycja.MeczId);
     ViewBag.ZawodnikId = new SelectList(db.Zawodnicy, "Id", "Imie", pozycja.ZawodnikId);
     return(View(pozycja));
 }
        public void Update(int scoreUpDate, int UserId)
        {
            var score = new ScoreTable()
            {
                score = scoreUpDate, users_id = UserId
            };
            var RankingScoreId = scoreContext.users.FirstOrDefault(x => x.id == UserId);
            var id             = Get(RankingScoreId.id);

            Updated    = score;
            Updated.id = RankingScoreId.id;
            scoreContext.Entry(id).CurrentValues.SetValues(Updated);
            scoreContext.SaveChanges();
        }
Ejemplo n.º 5
0
        public ActionResult Edit([Bind(Include =
                                           "Id,Kolejka,GolGospodarz,GolGosc,LiczbaWidzow,Data,GospodarzKlubId,GoscKlubId,SezonId,StadionId")]
                                 Mecz mecz)
        {
            if (ModelState.IsValid)
            {
                db.Entry(mecz).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.GoscKlubId      = new SelectList(db.Kluby, "Id", "Nazwa", mecz.GoscKlubId);
            ViewBag.GospodarzKlubId = new SelectList(db.Kluby, "Id", "Nazwa", mecz.GospodarzKlubId);
            ViewBag.SezonId         = new SelectList(db.Sezony, "Id", "Nazwa", mecz.SezonId);
            ViewBag.StadionId       = new SelectList(db.Stadiony, "Id", "Nazwa", mecz.StadionId);
            return(View(mecz));
        }
Ejemplo n.º 6
0
 public ActionResult Edit([Bind(Include = "Id,Nazwa,Adres,KodPocztowy,Wojewodztwo,Barwy,DataPowstania,Herb")] Klub klub)
 {
     if (ModelState.IsValid)
     {
         HttpPostedFileBase file = Request.Files["herbKlub"];
         if (file != null && file.ContentLength > 0)
         {
             klub.Herb = System.Guid.NewGuid().ToString();
             klub.Herb = file.FileName;
             file.SaveAs(HttpContext.Server.MapPath("~/Images/Herby") + klub.Herb);
         }
         db.Entry(klub).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(klub));
 }
Ejemplo n.º 7
0
 public ActionResult Edit([Bind(Include = "Id,Nazwa,Pojemnosc,Miasto,Zdjecie")] Stadion stadion)
 {
     if (ModelState.IsValid)
     {
         HttpPostedFileBase file = Request.Files["zdjecieStadion"];
         if (file != null && file.ContentLength > 0)
         {
             stadion.Zdjecie = System.Guid.NewGuid().ToString();
             stadion.Zdjecie = file.FileName;
             file.SaveAs(HttpContext.Server.MapPath("~/Images/") + stadion.Zdjecie);
         }
         db.Entry(stadion).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(stadion));
 }
 public ActionResult Edit([Bind(Include = "Id,Imie,Nazwisko,KrajPochodzenia,DataUrodzenia,Wzrost,Waga,NumerKoszulki,KlubId")] Zawodnik zawodnik)
 {
     if (ModelState.IsValid)
     {
         HttpPostedFileBase file = Request.Files["zdjecieZawodnik"];
         if (file != null && file.ContentLength > 0)
         {
             zawodnik.Zdjecie = System.Guid.NewGuid().ToString();
             zawodnik.Zdjecie = file.FileName;
             file.SaveAs(HttpContext.Server.MapPath("~/Images/Zawodnicy/") + zawodnik.Zdjecie);
         }
         db.Entry(zawodnik).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.KlubId = new SelectList(db.Kluby, "Id", "Nazwa", zawodnik.KlubId);
     return(View(zawodnik));
 }
Ejemplo n.º 9
0
        public ActionResult DeleteLog_withoutspace(string time)
        {
            User u = (User)Session["User"];

            ViewBag.account = u.user_account;
            Score[]     sList = sc.ScoreList.Where(s => s.uploader == u.user_account && s.uploadtime == time).ToArray();
            Puzzle[]    pList = pc.PuzzleList.Where(p => p.uploader == u.user_account && p.uploadtime == time).ToArray();
            Knowledge[] kList = kc.KnowledgeList.Where(k => k.uploader == u.user_account && k.uploadtime == time).ToArray();
            for (int i = 0; i < sList.Length; i++)
            {
                if (ModelState.IsValid)
                {
                    sc.ScoreList.Remove(sList[i]);
                    sc.SaveChanges();
                }
                else
                {
                    return(Content("error"));
                }
            }
            for (int i = 0; i < kList.Length; i++)
            {
                if (ModelState.IsValid)
                {
                    kc.KnowledgeList.Remove(kList[i]);
                    kc.SaveChanges();
                }
                else
                {
                    return(Content("error"));
                }
            }
            for (int i = 0; i < pList.Length; i++)
            {
                if (ModelState.IsValid)
                {
                    pc.PuzzleList.Remove(pList[i]);
                    pc.SaveChanges();
                }
                else
                {
                    return(Content("error"));
                }
            }
            sList = sc.ScoreList.ToArray();
            int max_index = Convert.ToInt32(time);

            for (int i = 0; i < sList.Length; i++)
            {
                if (Convert.ToInt32(sList[i].updatetime) > max_index)
                {
                    max_index = (Convert.ToInt32(sList[i].updatetime));
                }
            }
            for (int i = Convert.ToInt32(time) + 1; i <= max_index; i++)
            {
                string temp = i.ToString();
                sList = sc.ScoreList.Where(s => s.updatetime == temp).ToArray();
                for (int j = 0; j < sList.Length; j++)
                {
                    Score s = sList[j];
                    s.updatetime = (i - 1).ToString();
                    sc.ScoreList.Attach(s);
                    sc.Entry(s).State = System.Data.EntityState.Modified;
                }
                sc.SaveChanges();
            }
            return(Content("ok"));
        }