public async Task <ActionResult> Post(Customer customer) { _logger.LogInformation($"Customers /POST"); customer.CreatedAt = DateTimeOffset.UtcNow; using var db = new EvtContext(); db.Add(customer); await db.SaveChangesAsync(); return(CreatedAtAction(nameof(Get), customer.CustomerId)); }
public async Task <ActionResult> Post(Product product) { this._logger.LogInformation($"Products /POST"); product.CreatedAt = DateTimeOffset.UtcNow; using var db = new EvtContext(); db.Add(product); await db.SaveChangesAsync(); return(CreatedAtAction(nameof(Get), product.ProductId)); }