public void SetUp() { transaction = new TransactionScope(); DALFactory factory = DALFactory.GetInstance(); db = factory.CreateDatabase(); dao = factory.CreateCategoryDAO(db); category = new Category { Id = 1, Description = "Musik", Color = "red" }; runDbCommands(db, new List<string> { "SET FOREIGN_KEY_CHECKS=0", "DELETE FROM `category`", "INSERT INTO `category` VALUES (1, 'Musik', 'red')", "INSERT INTO `category` VALUES (2, 'Tanz', 'blue')" }); }
public Task<Category> GetCategoryByIdAsync(Category category) { return Task.Run(() => GetCategoryById(category)); }
public abstract Category GetCategoryById(Category category);
public Task<IEnumerable<Artist>> GetArtistsForCategoryAsync(Category category) { return Task.Run(() => GetArtistsForCategory(category)); }
public abstract IEnumerable<Artist> GetArtistsForCategory(Category category);
public void SetUp() { category = new Category(); }
public Category GetCategoryById(Category category) { return bl.GetCategoryById(category); }
public List<Artist> GetArtistsForCategory(Category category) { return bl.GetArtistsForCategory(category).ToList(); }
public IEnumerable<Artist> GetForCategory(Category category) { var result = new List<Artist>(); DbCommand cmd = createSelectForCategoryCommand(category); using (IDataReader reader = db.ExecuteReader(cmd)) { while (reader.Read()) { result.Add(createArtistFromReader(reader)); } } return result; }
private DbCommand createSelectForCategoryCommand(Category category) { DbCommand cmd = db.CreateCommand(SQL_SELECT_FOR_CATEGORY); db.DefineParameter(cmd, "@CategoryId", DbType.Int32, category.Id); db.DefineParameter(cmd, "@Deleted", DbType.Boolean, false); return cmd; }
public static bool IsEqualTo(this Category c1, Category c2) { return c1.Id == c2.Id && c1.Description == c2.Description && c1.Color == c2.Color; }
public CategoryViewModel(Category category) { this.Category = category; bl = BusinessLogicFactory.GetBusinessLogic(); }
public override Category GetCategoryById(Category category) { return dalFactory.CreateCategoryDAO(db).GetById(category.Id); }
public override IEnumerable<Artist> GetArtistsForCategory(Category category) { return dalFactory.CreateArtistDAO(db).GetForCategory(category); }