Exemplo n.º 1
0
 public async Task Add(Retailer retailer)
 {
     _context.Set <RetailerDbModel>()
     .Add(new RetailerDbModel()
     {
         Id                = Guid.NewGuid(),
         CPF               = retailer.CPF.Value,
         Name              = retailer.Name,
         Password          = retailer.Password,
         Email             = retailer.Email.Address,
         PreApprovedOrders = retailer.PreApprovedOrders
     });
     await _context.SaveChangesAsync();
 }
Exemplo n.º 2
0
        public async Task Add(Order order)
        {
            var retailer = await _context.Set <RetailerDbModel>().FirstOrDefaultAsync(r => r.CPF == order.Retailer.CPF.Value);

            _context.Set <OrderDbModel>()
            .Add(new OrderDbModel()
            {
                Code          = order.Code,
                RetailerId    = retailer.Id,
                Value         = order.Value,
                ReferenceDate = order.ReferenceDate,
                Status        = order.Status
            });
            await _context.SaveChangesAsync();
        }