public IHttpActionResult PostRankTable(RankTable rankTable) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.RankTables.Add(rankTable); try { db.SaveChanges(); } catch (DbUpdateException) { if (RankTableExists(rankTable.RankID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = rankTable.RankID }, rankTable)); }
public IHttpActionResult PutRankTable(int id, RankTable rankTable) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != rankTable.RankID) { return(BadRequest()); } db.Entry(rankTable).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!RankTableExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetRankTable(int id) { RankTable rankTable = db.RankTables.Find(id); if (rankTable == null) { return(NotFound()); } return(Ok(rankTable)); }
public IHttpActionResult DeleteRankTable(int id) { RankTable rankTable = db.RankTables.Find(id); if (rankTable == null) { return(NotFound()); } db.RankTables.Remove(rankTable); db.SaveChanges(); return(Ok(rankTable)); }
public GroupLookup() { foreach (var factionId in FactionIds) { var selectedFactionTuples = GroupHumanLookupTable.FactionTableHuman.Where(x => x.Item1 == factionId); var factionTable = new RankTable(); foreach (var factionTuple in selectedFactionTuples) { factionTable.Add(factionTuple.Item2, factionTuple.Item3); } factionTableEfficient.Add(factionId, factionTable); } foreach (var gangId in GangIds) { var selectedGangTuples = GroupHumanLookupTable.GangTableHuman.Where(x => x.Item1 == gangId); var gangTable = new RankTable(); foreach (var gangTuple in selectedGangTuples) { gangTable.Add(gangTuple.Item2, gangTuple.Item3); } gangTableEfficient.Add(gangId, gangTable); } foreach (var companyId in CompanyIds) { var selectedCompanyTuples = GroupHumanLookupTable.CompanyTableHuman.Where(x => x.Item1 == companyId); var companyTable = new RankTable(); foreach (var companyTuple in selectedCompanyTuples) { companyTable.Add(companyTuple.Item2, companyTuple.Item3); } companyTableEfficient.Add(companyId, companyTable); } }