public ActionResult Edit([Bind(Include = "ID,Name")] Country country)
 {
     if (ModelState.IsValid)
     {
         db.Entry(country).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(country));
 }
 public ActionResult Edit([Bind(Include = "ID,Name,UserID")] EntityManager entityManager)
 {
     if (ModelState.IsValid)
     {
         db.Entry(entityManager).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(entityManager));
 }
 public ActionResult Edit([Bind(Include = "ID,ChampshipID,DateBegin,DateEnd")] Journey journey)
 {
     if (ModelState.IsValid)
     {
         db.Entry(journey).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ChampshipID = new SelectList(db.Championship, "ID", "Name", journey.ChampshipID);
     return(View(journey));
 }
 public ActionResult Edit([Bind(Include = "ID,ChampshipID,Year,NumberOfTeams")] Season season)
 {
     if (ModelState.IsValid)
     {
         db.Entry(season).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ChampshipID = new SelectList(db.Championship, "ID", "Name", season.ChampshipID);
     return(View(season));
 }
 public ActionResult Edit([Bind(Include = "ID,Name,Logo,FundationDate,CountryID,City")] Team team)
 {
     if (ModelState.IsValid)
     {
         db.Entry(team).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CountryID = new SelectList(db.Country, "ID", "Name", team.CountryID);
     return(View(team));
 }
 public ActionResult Edit([Bind(Include = "ID,Name,Birth,CountryID,TeamID")] Player player)
 {
     if (ModelState.IsValid)
     {
         db.Entry(player).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CountryID = new SelectList(db.Country, "ID", "Name", player.CountryID);
     ViewBag.TeamID    = new SelectList(db.Team, "ID", "Name", player.TeamID);
     return(View(player));
 }
 public ActionResult Edit([Bind(Include = "ID,JourneyID,Date,KickoffTime,VisitorTeamID,GuestTeamID")] Match match)
 {
     if (ModelState.IsValid)
     {
         db.Entry(match).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.GuestTeamID   = new SelectList(db.Team, "ID", "Name", match.GuestTeamID);
     ViewBag.VisitorTeamID = new SelectList(db.Team, "ID", "Name", match.VisitorTeamID);
     return(View(match));
 }
 public ActionResult Edit([Bind(Include = "TeamID,ChampshipID,Points")] TeamPoints teamPoints)
 {
     if (ModelState.IsValid)
     {
         db.Entry(teamPoints).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ChampshipID = new SelectList(db.Championship, "ID", "Name", teamPoints.ChampshipID);
     ViewBag.TeamID      = new SelectList(db.Team, "ID", "Name", teamPoints.TeamID);
     return(View(teamPoints));
 }
 public ActionResult Edit([Bind(Include = "ID,MatchID,TeamID,PlayerID,Time")] MatchGoals matchGoals)
 {
     if (ModelState.IsValid)
     {
         db.Entry(matchGoals).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MatchID  = new SelectList(db.Match, "ID", "ID", matchGoals.MatchID);
     ViewBag.PlayerID = new SelectList(db.Player, "ID", "Name", matchGoals.PlayerID);
     ViewBag.TeamID   = new SelectList(db.Team, "ID", "Name", matchGoals.TeamID);
     return(View(matchGoals));
 }
        public ActionResult Edit([Bind(Include = "ID,Name,LogoPath,FoudationDate,CountryID,EntityMngID")] Championship championship)
        {
            if (championship.LogoPath != null &&
                championship.LogoPath.ContentLength > 0 &&
                championship.LogoPath.FileName != Path.GetFileName(championship.Logo))
            {
                string filename = Path.GetFileName(championship.Logo);

                var imagePath = Path.Combine(Server.MapPath(Utils.UPLOAD), filename);
                var imageUrl  = Path.Combine(Utils.UPLOAD, filename);
                championship.LogoPath.SaveAs(imagePath);

                championship.Logo = String.Concat(Utils.UPLOAD, "/", filename);
            }

            if (ModelState.IsValid)
            {
                try {
                    db.Entry(championship).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Details", new { id = championship.ID }));
                } catch (DbEntityValidationException dbEx) {
                    foreach (var validationErrors in dbEx.EntityValidationErrors)
                    {
                        foreach (var validationError in validationErrors.ValidationErrors)
                        {
                            System.Diagnostics.Trace.TraceInformation("\n\rProperty: {0}\n\r Error: {1}", validationError.PropertyName, validationError.ErrorMessage);
                            return(RedirectToAction("Edit", new { id = championship.ID }));
                        }
                    }
                }
            }

            /*if (ModelState.IsValid)
             * {
             *  db.Entry(championship).State = EntityState.Modified;
             *  db.SaveChanges();
             *  return RedirectToAction("Index");
             * }*/
            ViewBag.EntityMngID = new SelectList(db.EntityManager, "ID", "Name", championship.EntityMngID);
            ViewBag.CountryID   = new SelectList(db.Country, "ID", "Name", championship.CountryID);
            return(View(championship));
        }