Skip to content

Instantly share code, notes, and snippets.

@mr5z

mr5z/wtf.cs

Created Oct 29, 2020
Embed
What would you like to do?
[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