public void Create(Category item) { var parameters = new List <IDataParameter>() { _sqlFactory.CreateDbParameter("Name", item.Name, DbType.String) }; var connection = _sqlFactory.CreateSqlConnection(); using (var command = _sqlFactory.CreateDbCommand(DbConstant.Command.CreateCategory, connection, CommandType.StoredProcedure, parameters)) { command.Connection.Open(); command.ExecuteNonQuery(); } }
public void Create(Organizer item) { var parameters = new List <IDataParameter>() { _sqlFactory.CreateDbParameter("Name", item.Name, DbType.String), _sqlFactory.CreateDbParameter("Email", item.Email, DbType.String), _sqlFactory.CreateDbParameter("Phones", item.Phones, DbType.String) }; var connection = _sqlFactory.CreateSqlConnection(); using (var command = _sqlFactory.CreateDbCommand(DbConstant.Command.CreateOrganizer, connection, CommandType.StoredProcedure, parameters)) { command.Connection.Open(); command.ExecuteNonQuery(); } }
public void Create(User item) { var parameters = new List <IDataParameter>() { _sqlFactory.CreateDbParameter("Login", item.Login, DbType.String), _sqlFactory.CreateDbParameter("Password", item.Password, DbType.String), _sqlFactory.CreateDbParameter("Name", item.Name, DbType.String), _sqlFactory.CreateDbParameter("LastName", item.LastName, DbType.String), _sqlFactory.CreateDbParameter("Email", item.Email, DbType.String), _sqlFactory.CreateDbParameter("RoleId", item.Role.Id, DbType.Int32) }; var connection = _sqlFactory.CreateSqlConnection(); using (var command = _sqlFactory.CreateDbCommand(DbConstant.Command.CreateUser, connection, CommandType.StoredProcedure, parameters)) { command.Connection.Open(); command.ExecuteNonQuery(); } }
public void Create(Event item) { var parameters = new List <IDataParameter>() { _sqlFactory.CreateDbParameter("Name", item.Name, DbType.String), _sqlFactory.CreateDbParameter("Date", item.Date, DbType.DateTime), _sqlFactory.CreateDbParameter("ImagePath", item.ImagePath, DbType.String), _sqlFactory.CreateDbParameter("Image", item.Image, DbType.Binary), _sqlFactory.CreateDbParameter("Address", item.Address, DbType.String), _sqlFactory.CreateDbParameter("Description", item.Description, DbType.String), _sqlFactory.CreateDbParameter("Location", item.Location, DbType.String), _sqlFactory.CreateDbParameter("CategoryId", item.Category.Id, DbType.Int32), _sqlFactory.CreateDbParameter("OrganizerId", item.Organizer.Id, DbType.Int32), _sqlFactory.CreateDbParameter("StatusId", item.Status, DbType.Int32), _sqlFactory.CreateDbParameter("UserId", item.UserId, DbType.Int32) }; var connection = _sqlFactory.CreateSqlConnection(); using (var command = _sqlFactory.CreateDbCommand(DbConstant.Command.CreateEvent, connection, CommandType.StoredProcedure, parameters)) { command.Connection.Open(); command.ExecuteNonQuery(); } }