public ActionResult Create(TeamModel teammodel) { if (ModelState.IsValid) { db.Teams.Add(teammodel); db.SaveChanges(); return RedirectToAction("Index"); } return View(teammodel); }
// POST api/TeamAPI public HttpResponseMessage PostTeamModel(TeamModel teammodel) { if (ModelState.IsValid) { db.Teams.Add(teammodel); db.SaveChanges(); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, teammodel); response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = teammodel.ID })); return response; } else { return Request.CreateResponse(HttpStatusCode.BadRequest); } }
// PUT api/TeamAPI/5 public HttpResponseMessage PutTeamModel(int id, TeamModel teammodel) { if (ModelState.IsValid && id == teammodel.ID) { db.Entry(teammodel).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { return Request.CreateResponse(HttpStatusCode.NotFound); } return Request.CreateResponse(HttpStatusCode.OK); } else { return Request.CreateResponse(HttpStatusCode.BadRequest); } }
public RoundModel(TeamModel[] teams) { this.teams = teams; }
public ActionResult Edit(TeamModel teammodel) { if (ModelState.IsValid) { db.Entry(teammodel).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(teammodel); }
private List<PlayerModel> GetAllPlayersInTeamById(TeamModel teammodel) { return (from player in db.PlayerModels where player.TeamName == teammodel.TeamName select player).ToList(); }