public async Task <IHttpActionResult> PutMapPlayerGuild(int id, MapPlayerGuild mapPlayerGuild) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != mapPlayerGuild.MapPlayerGuildId) { return(BadRequest()); } db.Entry(mapPlayerGuild).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MapPlayerGuildExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(int id) { MapPlayerGuild mapPlayerGuild = db.MapPlayerGuilds.Find(id); db.MapPlayerGuilds.Remove(mapPlayerGuild); db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task <IHttpActionResult> GetMapPlayerGuild(int id) { MapPlayerGuild mapPlayerGuild = await db.MapPlayerGuilds.FindAsync(id); if (mapPlayerGuild == null) { return(NotFound()); } return(Ok(mapPlayerGuild)); }
public ActionResult Edit([Bind(Include = "MapPlayerGuildId,PlayerId,GuildId")] MapPlayerGuild mapPlayerGuild) { if (ModelState.IsValid) { db.Entry(mapPlayerGuild).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.GuildId = new SelectList(db.Guilds, "GuildId", "Name", mapPlayerGuild.GuildId); ViewBag.PlayerId = new SelectList(db.Players, "PlayerId", "Name", mapPlayerGuild.PlayerId); return(View(mapPlayerGuild)); }
public async Task <IHttpActionResult> PostMapPlayerGuild(MapPlayerGuild mapPlayerGuild) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.MapPlayerGuilds.Add(mapPlayerGuild); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = mapPlayerGuild.MapPlayerGuildId }, mapPlayerGuild)); }
// GET: MapPlayerGuilds/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MapPlayerGuild mapPlayerGuild = db.MapPlayerGuilds.Find(id); if (mapPlayerGuild == null) { return(HttpNotFound()); } return(View(mapPlayerGuild)); }
public async Task <IHttpActionResult> DeleteMapPlayerGuild(int id) { MapPlayerGuild mapPlayerGuild = await db.MapPlayerGuilds.FindAsync(id); if (mapPlayerGuild == null) { return(NotFound()); } db.MapPlayerGuilds.Remove(mapPlayerGuild); await db.SaveChangesAsync(); return(Ok(mapPlayerGuild)); }
// GET: MapPlayerGuilds/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MapPlayerGuild mapPlayerGuild = db.MapPlayerGuilds.Find(id); if (mapPlayerGuild == null) { return(HttpNotFound()); } ViewBag.GuildId = new SelectList(db.Guilds, "GuildId", "Name", mapPlayerGuild.GuildId); ViewBag.PlayerId = new SelectList(db.Players, "PlayerId", "Name", mapPlayerGuild.PlayerId); return(View(mapPlayerGuild)); }