Ejemplo n.º 1
0
        public override async Task <Empty> UpdateNumber(Proto.Number request, ServerCallContext context)
        {
            var number = await dbContext.Numbers.FindAsync(request.Id);

            if (number == null)
            {
                number = new Number(request.Id, "");
                dbContext.Add(number);
            }
            number.NumberRfids = request.Rfids;
            await dbContext.SaveChangesAsync();

            return(new Empty());
        }
Ejemplo n.º 2
0
        public async Task AddOrUpdateResult(Result result)
        {
            var existing = await dataContext.Results.AnyAsync(r => r.Id == result.Id);

            if (existing)
            {
                dataContext.Update(result);
            }
            else
            {
                dataContext.Add(result);
            }
            await dataContext.SaveChangesAsync();
        }