示例#1
0
        public async Task <ActionResult> Post([FromBody] Trip value)
        {
            var result = await _context.Trips.AddAsync(value);

            var r = await _context.SaveChangesAsync();

            return(new OkResult());
        }
示例#2
0
        public async Task <ActionResult> Post([FromBody] Place value)
        {
            var place = await _context.Places.AddAsync(value);

            var result = await _context.SaveChangesAsync();

            return(new OkObjectResult(place));
        }
示例#3
0
        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));
            }
        }