public async Task Put(int id, [FromBody] Domain.CustomerAggregate.Customer value)
        {
            var customer = Get(id);

            if (customer != null)
            {
                await _customerRepository.Update(value);
            }
        }
Example #2
0
 public async Task Add(Domain.CustomerAggregate.Customer prod)
 {
     using (IDbConnection dbConnection = _dbProvider.Connection)
     {
         string sQuery = "INSERT INTO Customers (FirstName, LastName, Address, PhoneNumber, Email, Gender, Birthday)"
                         + " VALUES(@FirstName, @LastName, @Address, @PhoneNumber, @Email, @Gender, @Birthday)";
         dbConnection.Open();
         await dbConnection.ExecuteAsync(sQuery, prod);
     }
 }
Example #3
0
 public async Task Update(Domain.CustomerAggregate.Customer prod)
 {
     using (IDbConnection dbConnection = _dbProvider.Connection)
     {
         // Address, PhoneNumber, Email, Gender, Birthday
         string sQuery = "UPDATE Customers SET FirstName = @FirstName,"
                         + " LastName = @LastName"
                         + " Address = @Address"
                         + " PhoneNumber = @PhoneNumber"
                         + " Email = @Email"
                         + " Gender = @Gender"
                         + " Birthday = @Birthday"
                         + " WHERE CustomerId = @CustomerId";
         dbConnection.Open();
         await dbConnection.QueryAsync(sQuery, prod);
     }
 }
 public async Task Post([FromBody] Domain.CustomerAggregate.Customer value)
 {
     await _customerRepository.Add(value);
 }