示例#1
0
        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));
        }
示例#2
0
        public ActionResult DeleteConfirmed(int id)
        {
            MapPlayerGuild mapPlayerGuild = db.MapPlayerGuilds.Find(id);

            db.MapPlayerGuilds.Remove(mapPlayerGuild);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#3
0
        public async Task <IHttpActionResult> GetMapPlayerGuild(int id)
        {
            MapPlayerGuild mapPlayerGuild = await db.MapPlayerGuilds.FindAsync(id);

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

            return(Ok(mapPlayerGuild));
        }
示例#4
0
 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));
 }
示例#5
0
        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));
        }
示例#6
0
        // 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));
        }
示例#7
0
        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));
        }
示例#8
0
        // 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));
        }