//Adds an event to the database
 public ActionResult <Events> PostEvents([FromBody] Events eventItem)
 {
     _context.Events.Add(eventItem);
     _context.SaveChanges();
     // YES THIS WORKS THANK GOD
     //The big issue that I was having with this is that the id parameter isn't from the model - I thought I was supposed to use the EventModel here but nah,
     //I'm supposed to use the id parameter from GetEvent....
     return(CreatedAtAction("GetEvent", new { id = eventItem.EventId }, eventItem));
 }
Esempio n. 2
0
 //Add a new video / tag association
 public ActionResult <MapVideoTag> AddMapping(MapVideoTag newTag)
 {
     _context.MapVideoTag.Add(newTag);
     _context.SaveChanges();
     return(CreatedAtAction("GetMapTag", new { id = newTag.MapId }, newTag));
 }
 //Adds a player to the database
 public ActionResult <Players> PostPlayer([FromBody] Players newPlayer)
 {
     _context.Players.Add(newPlayer);
     _context.SaveChanges();
     return(CreatedAtAction("GetPlayer", new { id = newPlayer.PlayerId }, newPlayer));
 }
Esempio n. 4
0
 //Adds a character to the database
 public ActionResult <Characters> PostCharacter(Characters newCharacter)
 {
     _context.Characters.Add(newCharacter);
     _context.SaveChanges();
     return(CreatedAtAction("GetCharacter", new { id = newCharacter.CharacterId }, newCharacter));
 }
 //Adds a video to the database
 public ActionResult <Videos> PostVideo([FromBody] Videos newVideo)
 {
     _context.Videos.Add(newVideo);
     _context.SaveChanges();
     return(CreatedAtAction("GetVideo", new { id = newVideo.VideoId }, newVideo));
 }
 //Creating a new video / tag relation
 public ActionResult <VideoTags> PostTag(VideoTags newTag)
 {
     _context.VideoTags.Add(newTag);
     _context.SaveChanges();
     return(CreatedAtAction("GetSingleTag", new { id = newTag.TagId }, newTag));
 }