コード例 #1
0
        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));
        }
コード例 #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            MapPlayerPurchase mapPlayerPurchase = db.MapPlayerPurchases.Find(id);

            db.MapPlayerPurchases.Remove(mapPlayerPurchase);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #3
0
        public async Task <IHttpActionResult> GetMapPlayerPurchase(int id)
        {
            MapPlayerPurchase mapPlayerPurchase = await db.MapPlayerPurchases.FindAsync(id);

            if (mapPlayerPurchase == null)
            {
                return(NotFound());
            }

            return(Ok(mapPlayerPurchase));
        }
コード例 #4
0
        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));
        }
コード例 #5
0
 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));
 }
コード例 #6
0
        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));
        }
コード例 #7
0
        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));
        }
コード例 #8
0
        // 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));
        }
コード例 #9
0
        // 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));
        }