public async Task <IHttpActionResult> PutMapGuildChat(int id, MapGuildChat mapGuildChat)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != mapGuildChat.MapGuildChatId)
            {
                return(BadRequest());
            }

            db.Entry(mapGuildChat).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MapGuildChatExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            MapGuildChat mapGuildChat = db.MapGuildChats.Find(id);

            db.MapGuildChats.Remove(mapGuildChat);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public async Task <IHttpActionResult> GetMapGuildChat(int id)
        {
            MapGuildChat mapGuildChat = await db.MapGuildChats.FindAsync(id);

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

            return(Ok(mapGuildChat));
        }
Beispiel #4
0
 public ActionResult Edit([Bind(Include = "MapGuildChatId,ChatId,GuildId")] MapGuildChat mapGuildChat)
 {
     if (ModelState.IsValid)
     {
         db.Entry(mapGuildChat).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ChatId  = new SelectList(db.Chats, "ChatId", "TextMessage", mapGuildChat.ChatId);
     ViewBag.GuildId = new SelectList(db.Guilds, "GuildId", "Name", mapGuildChat.GuildId);
     return(View(mapGuildChat));
 }
        public async Task <IHttpActionResult> PostMapGuildChat(MapGuildChat mapGuildChat)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.MapGuildChats.Add(mapGuildChat);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = mapGuildChat.MapGuildChatId }, mapGuildChat));
        }
Beispiel #6
0
        // GET: MapGuildChats/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MapGuildChat mapGuildChat = db.MapGuildChats.Find(id);

            if (mapGuildChat == null)
            {
                return(HttpNotFound());
            }
            return(View(mapGuildChat));
        }
        public async Task <IHttpActionResult> DeleteMapGuildChat(int id)
        {
            MapGuildChat mapGuildChat = await db.MapGuildChats.FindAsync(id);

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

            db.MapGuildChats.Remove(mapGuildChat);
            await db.SaveChangesAsync();

            return(Ok(mapGuildChat));
        }
Beispiel #8
0
        // GET: MapGuildChats/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MapGuildChat mapGuildChat = db.MapGuildChats.Find(id);

            if (mapGuildChat == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ChatId  = new SelectList(db.Chats, "ChatId", "TextMessage", mapGuildChat.ChatId);
            ViewBag.GuildId = new SelectList(db.Guilds, "GuildId", "Name", mapGuildChat.GuildId);
            return(View(mapGuildChat));
        }