Example #1
0
 public ActionResult Edit([Bind(Include = "id,FirstName,LastName,TuesdayLeague,WednesdayLeague,shortname")] Player player)
 {
     if (ModelState.IsValid)
     {
         db.Entry(player).State = EntityState.Modified;
         try
         {
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         catch (System.Data.Entity.Infrastructure.DbUpdateException e)
         {
             Exception ex = e;
             ErrorSignal.FromCurrentContext().Raise(e);
             while (ex.InnerException != null)
             {
                 ex = ex.InnerException;
             }
             ModelState.AddModelError(string.Empty, ex.Message);
         }
         catch (Exception e)
         {
             ErrorSignal.FromCurrentContext().Raise(e);
             ModelState.AddModelError(string.Empty, "Edit failed");
         }
     }
     return(View(player));
 }
Example #2
0
 public ActionResult Edit([Bind(Include = "id,GameDate,IsCancelled")] TuesdaySchedule tuesdaySchedule)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tuesdaySchedule).State = EntityState.Modified;
         try
         {
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         catch (System.Data.Entity.Infrastructure.DbUpdateException e)
         {
             ErrorSignal.FromCurrentContext().Raise(e);
             Exception ex = e;
             while (ex.InnerException != null)
             {
                 ex = ex.InnerException;
             }
             ModelState.AddModelError(string.Empty, ex.Message);
         }
         catch (Exception e)
         {
             ErrorSignal.FromCurrentContext().Raise(e);
             ModelState.AddModelError(string.Empty, "Edit failed");
         }
     }
     return(View(tuesdaySchedule));
 }
Example #3
0
        public ActionResult RemoveLead(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TuesdayTeam tuesdayTeam = db.TuesdayTeams.Find(id);

            if (tuesdayTeam == null)
            {
                return(HttpNotFound());
            }
            tuesdayTeam.Lead            = null;
            db.Entry(tuesdayTeam).State = EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #4
0
        public ActionResult MoveUp(int id, int weekid)
        {
            var tuesdayMatches = db.TuesdayMatches.Where(x => x.GameDate == weekid).OrderBy(x => x.Rink);
            var match          = tuesdayMatches.First(x => x.Rink == id);
            var match1         = tuesdayMatches.First(x => x.Rink == id + 1);

            match1.Rink            = id;
            match.Rink             = id + 1;
            db.Entry(match).State  = EntityState.Modified;
            db.Entry(match1).State = EntityState.Modified;
            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                ErrorSignal.FromCurrentContext().Raise(e);
            }

            return(RedirectToAction("Index", new { ScheduleID = weekid }));
        }
        public ActionResult RemoveLead(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            WednesdayTeam WednesdayTeam = db.WednesdayTeams.Find(id);

            if (WednesdayTeam == null)
            {
                return(HttpNotFound());
            }
            WednesdayTeam.Lead            = null;
            db.Entry(WednesdayTeam).State = EntityState.Modified;
            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                ErrorSignal.FromCurrentContext().Raise(e);;
            }
            return(RedirectToAction("Index"));
        }