public override async Task <CreateResponse> CreateItem(CreateRequest request, ServerCallContext context) { _logger.LogInformation($"Create Request Received with body: {JsonConvert.SerializeObject(request)}"); var entity = new Item { Name = request.Name }; await _demoDbContext.AddAsync(entity); await _demoDbContext.SaveChangesAsync(); return(new CreateResponse { Id = entity.Id }); }
public async Task <int> Add(Product entity) { await _context.AddAsync(entity); return(await _context.SaveChangesAsync()); }