public async Task <IHttpActionResult> PutMapPlayerPurchase(int id, MapPlayerPurchase mapPlayerPurchase) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != mapPlayerPurchase.MapPlayerPurchaseId) { return(BadRequest()); } db.Entry(mapPlayerPurchase).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MapPlayerPurchaseExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(int id) { MapPlayerPurchase mapPlayerPurchase = db.MapPlayerPurchases.Find(id); db.MapPlayerPurchases.Remove(mapPlayerPurchase); db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task <IHttpActionResult> GetMapPlayerPurchase(int id) { MapPlayerPurchase mapPlayerPurchase = await db.MapPlayerPurchases.FindAsync(id); if (mapPlayerPurchase == null) { return(NotFound()); } return(Ok(mapPlayerPurchase)); }
public async Task <IHttpActionResult> PostMapPlayerPurchase(MapPlayerPurchase mapPlayerPurchase) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.MapPlayerPurchases.Add(mapPlayerPurchase); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = mapPlayerPurchase.MapPlayerPurchaseId }, mapPlayerPurchase)); }
public ActionResult Edit([Bind(Include = "MapPlayerPurchaseId,PlayerId,PurchaseId")] MapPlayerPurchase mapPlayerPurchase) { if (ModelState.IsValid) { db.Entry(mapPlayerPurchase).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PlayerId = new SelectList(db.Players, "PlayerId", "Name", mapPlayerPurchase.PlayerId); ViewBag.PurchaseId = new SelectList(db.Purchases, "PurchaseId", "PurchaseId", mapPlayerPurchase.PurchaseId); return(View(mapPlayerPurchase)); }
public ActionResult Create([Bind(Include = "MapPlayerPurchaseId,PlayerId,PurchaseId")] MapPlayerPurchase mapPlayerPurchase) { if (ModelState.IsValid) { db.MapPlayerPurchases.Add(mapPlayerPurchase); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PlayerId = new SelectList(db.Players, "PlayerId", "Name", mapPlayerPurchase.PlayerId); ViewBag.PurchaseId = new SelectList(db.Purchases, "PurchaseId", "PurchaseId", mapPlayerPurchase.PurchaseId); return(View(mapPlayerPurchase)); }
public async Task <IHttpActionResult> DeleteMapPlayerPurchase(int id) { MapPlayerPurchase mapPlayerPurchase = await db.MapPlayerPurchases.FindAsync(id); if (mapPlayerPurchase == null) { return(NotFound()); } db.MapPlayerPurchases.Remove(mapPlayerPurchase); await db.SaveChangesAsync(); return(Ok(mapPlayerPurchase)); }
// GET: MapPlayerPurchases/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MapPlayerPurchase mapPlayerPurchase = db.MapPlayerPurchases.Find(id); if (mapPlayerPurchase == null) { return(HttpNotFound()); } return(View(mapPlayerPurchase)); }
// GET: MapPlayerPurchases/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MapPlayerPurchase mapPlayerPurchase = db.MapPlayerPurchases.Find(id); if (mapPlayerPurchase == null) { return(HttpNotFound()); } ViewBag.PlayerId = new SelectList(db.Players, "PlayerId", "Name", mapPlayerPurchase.PlayerId); ViewBag.PurchaseId = new SelectList(db.Purchases, "PurchaseId", "PurchaseId", mapPlayerPurchase.PurchaseId); return(View(mapPlayerPurchase)); }