Personmodel handled as dbtabel and as file
This commit is contained in:
@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
using TrackerLibrary.Models;
|
||||
|
||||
|
||||
//@PlaceNumber int,
|
||||
@ -15,6 +16,24 @@ namespace TrackerLibrary.DataAccess
|
||||
{
|
||||
public class SqlConnector : IDataConnection
|
||||
{
|
||||
public PersonModel CreatePerson(PersonModel model)
|
||||
{
|
||||
using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(GlobalConfig.CnnString("Tournaments"))) {
|
||||
var p = new DynamicParameters();
|
||||
p.Add("@FirstName", model.FirstName);
|
||||
p.Add("@LastName", model.LastName);
|
||||
p.Add("@EmailAddress", model.EmailAddress);
|
||||
p.Add("@CellPhoneNumber", model.CellPhoneNumber);
|
||||
p.Add("@Id", 0, dbType: DbType.Int32, direction: ParameterDirection.Output);
|
||||
|
||||
connection.Execute("dbo.spPeople_Insert", p, commandType: CommandType.StoredProcedure);
|
||||
|
||||
model.Id = p.Get<int>("@Id");
|
||||
|
||||
return model;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO - Make the CreatePrize method actually save to the database
|
||||
/// <summary>
|
||||
/// Saves a prize to the database
|
||||
|
||||
Reference in New Issue
Block a user