public bool GetAll(out IEnumerable <KeyValuePair <Guid, LinkUserAward> > collection, out string errorMessage) { bool result; try { result = linkDao.GetAll(out collection, out errorMessage); } catch (Exception ex) { WriteToLog(ex); errorMessage = "Sorry. Data access error. Сontact the developer."; collection = new List <KeyValuePair <Guid, LinkUserAward> >(0); return(false); } collection = collection.ToList(); return(result); }
public void GetAllShouldReturnFiveMedia() { AddObjects(5); IQueryable <T> objects = dao.GetAll(); Assert.AreEqual(addedObjects.Count, objects.Count <T>()); }
public bool GetLeftJoin(out IEnumerable <KeyValuePair <User, Award> > collection, out string errorMessage) { var result = new List <KeyValuePair <User, Award> >(0); IEnumerable <KeyValuePair <Guid, User> > leftSet; IEnumerable <KeyValuePair <Guid, LinkUserAward> > linkSet; IEnumerable <KeyValuePair <Guid, Award> > rightSet; if (!leftDao.GetAll(out leftSet, out errorMessage) || !linkDao.GetAll(out linkSet, out errorMessage) || !rightDao.GetAll(out rightSet, out errorMessage)) { errorMessage = "Sorry. Error in data access layer. Сontact the developer."; collection = result; return(false); } try { result = leftSet .Join( linkSet, x => x.Key, y => y.Value.UserId, (x, y) => new KeyValuePair <User, Guid>(x.Value, y.Value.AwardId)) .Join( rightSet, a => a.Value, b => b.Key, (x, y) => new KeyValuePair <User, Award>(x.Key, y.Value)) .OrderBy(x => x.Key.Name).ToList(); } catch (Exception ex) { WriteToLog(ex); errorMessage = "Sorry. Error in data access layer. Сontact the developer."; collection = new List <KeyValuePair <User, Award> >(0); return(false); } errorMessage = string.Empty; collection = result; return(true); }
public virtual IList <T> GetAll() { return(_dao.GetAll()); }