public bool CreateSinger(SingerViewModel singer) { bool inserted; if (useMock) { singerDaoMock = new SingerDaoMock(); inserted = singerDaoMock.InsertSinger(SingerMapper.ViewModelToModel(singer)); } else { singerDao = new SingerDao(); inserted = singerDao.InsertSinger(SingerMapper.ViewModelToModel(singer)); } return(inserted); }
public List <SingerViewModel> GetSingersByKindOfMusic(string kindOfMusic) { List <SingerViewModel> singerViewModels = new List <SingerViewModel>(); List <SingerModel> singers = new List <SingerModel>(); if (useMock) { singerDaoMock = new SingerDaoMock(); singers = singerDaoMock.GetSingersByKindOfMusic(kindOfMusic); } else { singerDao = new SingerDao(); singers = singerDao.GetSingersByKindOfMusic(kindOfMusic); } foreach (SingerModel item in singers) { singerViewModels.Add(SingerMapper.ModelToViewModel(item)); } return(singerViewModels); }