Skip to content

Instantly share code, notes, and snippets.

@mr5z
Created October 29, 2020 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mr5z/14d3023934f4bacc80c5c01d09288964 to your computer and use it in GitHub Desktop.
Save mr5z/14d3023934f4bacc80c5c01d09288964 to your computer and use it in GitHub Desktop.
[HttpPost]
public async Task<ActionResult<Cave>> PostCave([FromBody]CaveDto cave)
{
context.Point.Add(new Point
{
});
context.Path.Add(new Path
{
});
context.Map.Add(new Map
{
});
context.Cave.Add(new Cave
{
DeviceOrigin = cave.DeviceOrigin,
DateCreated = cave.DateCreated,
Duration = cave.Duration,
EndPointRadius = cave.EndPointRadius,
Name = cave.Name,
ShowJumpScare = cave.ShowJumpScare,
AuthorId = cave.Author.Id, // generated from client side
MapId = cave.Map.Id, // TODO
PathId = cave.Path.Id, // TODO
});
await context.SaveChangesAsync();
return CreatedAtAction("GetCave", new { id = cave.Id }, cave);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment