public ActionResult Create(Team t)
 {
     t.CreatedDate = DateTime.Now;
     db.Teams.Add(t);
     db.SaveChanges();
     return RedirectToAction("Index");
 }
 public ActionResult Edit(Team team)
 {
     Team t = db.Teams.Find(team.TeamId);
     if (TryUpdateModel<Team>(t))
     {
         try
         {
             db.Entry(t).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
         }
         catch (Exception ex)
         {
             ModelState.AddModelError("", "Error updating model " + ex.Message);
         }
     }
     return RedirectToAction("Index");
 }
 public ActionResult Create()
 {
     Team t = new Team();
     return View(t);
 }
示例#4
0
        public MemoryStream CreatePDF(Team teamToPrint)
        {
            try
                {
                    return PDFCreator.CreatePDF(db.Students.Include("Team").Include("Credentials").Where(x => x.Team.TeamId == teamToPrint.TeamId).ToArray());

                }
                catch (Exception)
                {
                    throw;
                }
        }