public async Task <ActionResult> Post([FromBody] Trip value) { var result = await _context.Trips.AddAsync(value); var r = await _context.SaveChangesAsync(); return(new OkResult()); }
public async Task <ActionResult> Post([FromBody] Place value) { var place = await _context.Places.AddAsync(value); var result = await _context.SaveChangesAsync(); return(new OkObjectResult(place)); }
public async Task <ActionResult> Post([FromBody] User value) { try { var user = await _context.Users.AddAsync(value); var result = await _context.SaveChangesAsync(); return(new OkObjectResult(user.Entity)); } catch (Exception ex) { _logger.LogError(new EventId(42), ex, $"Error occured while inserting User with UserId: '{value.Id}'."); return(StatusCode(500)); } }