public int GenreCreate( string Name) { GenreDAL dal = new GenreDAL(_connection); return(dal.GenreCreate(Name)); }
public int GenreUpdateJust( int GenreID, string Name) { GenreDAL dal = new GenreDAL(_connection); return(dal.GenreUpdateJust(GenreID, Name)); }
public static List <GenreEntity> ViewAllGenreBL() { List <GenreEntity> genreList = null; GenreDAL genreDAL = new GenreDAL(); genreList = genreDAL.ViewAllGenreDAL(); return(genreList); }
public static GenreEntity SearchGenreBL(int genreId) { GenreEntity feedback; GenreDAL langDAL = new GenreDAL(); feedback = langDAL.SearchGenre(genreId); return(feedback); }
public GenreBLL GenreFindByID(int GenreID) { GenreBLL ExpectedReturnValue = null; GenreDAL info = context.GenreFindByID(GenreID); if (info != null) { ExpectedReturnValue = new GenreBLL(info); } return(ExpectedReturnValue); }
public int GenreUpdateSafe( int GenreID, string oldName, string newName) { GenreDAL dal = new GenreDAL(_connection); return(dal.GenreUpdateSafe(GenreID, oldName, newName)); }
public static bool AddGenreBL(GenreEntity newGenre) { bool genreAdded = false; if (ValidateGenre(newGenre)) { GenreDAL genreDAL = new GenreDAL(); genreAdded = genreDAL.AddGenreDAL(newGenre); } return(genreAdded); }
/// <summary> /// Hämtar alla Genre i databasen /// </summary> /// <param name="refresh"></param> /// <returns>Ett listobjekt som innehåller referenser till Genre-objektet</returns> public IEnumerable <Genre> GetGenreType(bool refresh = false) { // Hämtar listan med genretyperna från cachen var genreTypes = HttpContext.Current.Cache["GenreTypes"] as IEnumerable <Genre>; // Om det inte finns någon lista med genre if (genreTypes == null || refresh) { // Så hämtar vi listan med genre från databasen. genreTypes = GenreDAL.GetGenreType(); // Sen cachar vi detta list-objekt och genre-objekt. Det kommer att ske igen efter 25 min //då denna data inte har någon CRUD. HttpContext.Current.Cache.Insert("GenreTypes", genreTypes, null, DateTime.Now.AddMinutes(25), TimeSpan.Zero); } return(genreTypes); }
public void GenreTest() { // arrange GenreDAL dal = new GenreDAL(MagicSetup.Connection); // act create int rv1 = dal.GenreCreate("Test1"); Assert.IsTrue(rv1 > 0, $"GenreCreate failed rv = {rv1}"); Genre a = dal.GenreFindByID(rv1); Assert.IsNotNull(a, $"GenreFindByID for ID {rv1} (just created) returned null"); Assert.IsTrue(a.GenreName == "Test1", $"GenreName was expected to be 'Test1' but found {a.GenreName}"); int countofGenres = dal.GenresObtainCount(); Assert.IsTrue(countofGenres > 0, $"GenresObtainCount should be greater than 0 it is {countofGenres}"); List <Genre> Genres = dal.GenresGetAll(); Assert.IsTrue(Genres.Count == countofGenres, $"GenresGetAll should have brought back {countofGenres} records, but it only found {Genres.Count}"); DateTime now = DateTime.Now; int number = dal.GenreUpdateJust(rv1, "Test1New"); Assert.IsTrue(number == 1, $"GenreUpdateJust was expected to return 1, but actually returned {number}"); a = dal.GenreFindByID(rv1); Assert.IsNotNull(a, $"GenreFindByID for ID {rv1} (just updated) returned null"); Assert.IsTrue(a.GenreName == "Test1New", $"GenreName after update was expected to be 'Test1New' but was actually '{a.GenreName}'"); number = dal.GenreUpdateSafe(rv1, "Test1New", "1"); Assert.IsTrue(number == 1, $"GenreUpdateSafe was expected to return 1 but actually returned {number}"); a = dal.GenreFindByID(rv1); Assert.IsNotNull(a, $"GenreFindByID for ID {rv1} (just safe updated) returned null"); Assert.IsTrue(a.GenreName == "1", $"Genrename after safeupdate was expected to be '1', but was '{a.GenreName}"); number = dal.GenreUpdateSafe(rv1, "2", "4"); Assert.IsTrue(number == 0, $"Genreupdatesafe was expected to return 0, but it actually returned {number}"); dal.GenreDelete(rv1); }
public void GenreDelete(int GenreID) { GenreDAL dal = new GenreDAL(_connection); dal.GenreDelete(GenreID); }
public List <Genre> GenreGetAll(int skip = 0, int take = 0) { GenreDAL dal = new GenreDAL(_connection); return(dal.GenresGetAll(skip, take)); }
public Genre GenreFindByID(int GenreID) { GenreDAL dal = new GenreDAL(_connection); return(dal.GenreFindByID(GenreID)); }