Exemplo n.º 1
0
        private void SeedCustomer()
        {
            _customerCommandRepo.Insert(new CustomerInsertModel
            {
                Name         = "Admin customer",
                GoogleUserId = "AdminGoogleId",
                Balance      = 2000m,
                LocationId   = 1,
                RoleId       = 1
            });

            _customerCommandRepo.Insert(new CustomerInsertModel
            {
                Name         = "User customer",
                GoogleUserId = "UserGoogleId",
                Balance      = -400m,
                LocationId   = 2,
                RoleId       = 2
            });
        }
Exemplo n.º 2
0
        private IActionResult SignInUser(PagingResult <DomainModel.Customer> customers, string googleId)
        {
            if (!customers.Items.Any())
            {
                return(_commandRepo.Insert(
                           new CustomerInsertModel
                {
                    Balance = 0,
                    GoogleUserId = googleId,
                    Name = User.Claims.FirstOrDefault(x => x.Type.EndsWith("name"))?.Value
                })
                       .Map(x => AllOk(new { id = x }))
                       .Reduce(_ => InternalServerError(), x => _logger.LogError(x.ToString())));
            }

            return(AllOk(new { id = customers.Items.First().Id }));
        }