public IDomainIdentifiable<long> Create(IDomainIdentifiable<long> entity) { entity.Id = _muscleGroups.Count() + 1; _muscleGroups.Add(entity.Id, (MuscleGroup)entity); return entity; }
public IDomainIdentifiable<long> Create(IDomainIdentifiable<long> entity) { entity.Id = _exerciseInstances.Count() + 1; _exerciseInstances.Add(entity.Id, (ExerciseInstance)entity); return entity; }
public IDomainIdentifiable<long> Create(IDomainIdentifiable<long> entity) { _context.OpenConnection(); _context.BeginTransaction(); // get nextval const string sqlGetNextId = "SELECT MAX(id) + 1 FROM muscle_group"; var command = new OracleCommand(sqlGetNextId, _context.DbConnection); object obj = command.ExecuteScalar(); entity.Id = Convert.ToInt64(obj); // insert const string sqlInsert = "INSERT INTO muscle_group (id, name) VALUES (:id, :name)"; command = new OracleCommand(sqlInsert, _context.DbConnection); AddIdParam(command, entity.Id); AddColumnParams(command, (MuscleGroup)entity); command.Prepare(); command.ExecuteNonQuery(); return entity; }
public IDomainIdentifiable<long> Update(IDomainIdentifiable<long> entity) { _muscleGroups[entity.Id] = (MuscleGroup)entity; return entity; }
public IDomainIdentifiable<long> Update(IDomainIdentifiable<long> entity) { _exerciseInstances[entity.Id] = (ExerciseInstance)entity; return entity; }
public IDomainIdentifiable<long> Update(IDomainIdentifiable<long> entity) { _context.OpenConnection(); _context.BeginTransaction(); const string sqlUpdate = "UPDATE muscle_group SET name = :name WHERE id = :id"; var command = new OracleCommand(sqlUpdate, _context.DbConnection); AddColumnParams(command, (MuscleGroup)entity); AddIdParam(command, entity.Id); command.Prepare(); command.ExecuteNonQuery(); return entity; }
internal ChartData(IDomainIdentifiable<long> parent, List<ChartData> children) { Parent = parent; Children = children == null ? null : children.ToArray(); }