Exemplo n.º 1
0
 public ActionResult Create(Team team)
 {
     if (ModelState.IsValid) {
         teamRepository.InsertOrUpdate(team);
         teamRepository.Save();
         return RedirectToAction("Index");
     } else {
         return View();
     }
 }
Exemplo n.º 2
0
 public void InsertOrUpdate(Team team)
 {
     if (team.TeamId == default(int)) {
         // New entity
         context.Teams.Add(team);
     } else {
         // Existing entity
         context.Teams.Attach(team);
         context.Entry(team).State = EntityState.Modified;
     }
 }