예제 #1
0
 public void Update(Customer model)
 {
     using (var connection = new SqlConnection(connectionString))
     {
         var param = new
         {
             model.Id,
             model.Name,
             model.GenderId,
             model.HouseNumber,
             model.AddressLine1,
             model.State,
             model.CountryId,
             model.CategoryId,
             model.DateOfBirth,
             model.User
         };
         connection.Execute(
             AcmeDatabase.StoredProc_CustomerUpdate,
             param,
             commandType: CommandType.StoredProcedure);
     }
 }
예제 #2
0
 public int Insert(Customer model)
 {
     using (var connection = new SqlConnection(connectionString))
     {
         var param = new
         {
             model.Name,
             model.GenderId,
             model.HouseNumber,
             model.AddressLine1,
             model.State,
             model.CountryId,
             model.CategoryId,
             model.DateOfBirth,
             model.User
         };
         return(connection.Query <int>(
                    AcmeDatabase.StoredProc_CustomerInsert,
                    param,
                    commandType: CommandType.StoredProcedure)
                .First());
     }
 }