public ProfileContract GetByUserId(int userId, bool includeImages) { using (var dbConnector = new DBConnector()) { ProfileManager profileManager = new ProfileManager(dbConnector.DataContext); var profile = profileManager.GetByUserId(userId, includeImages); return(ProfilesTranslator.ConvertToProfileContract(profile)); } }
public List <ProfileContract> Search(Func <dynamic, bool> criteria) { using (var dbConnector = new DBConnector()) { ProfileManager profileManager = new ProfileManager(dbConnector.DataContext); Func <Profile, bool> profileCriteria = (Func <Profile, bool>)criteria; return(ProfilesTranslator.ConvertToProfileContract(profileManager.Search(profileCriteria)).ToList()); } }
public void Update(ProfileContract user) { using (var dbConnector = new DBConnector()) { ProfileManager profileManager = new ProfileManager(dbConnector.DataContext); var userEntity = ProfilesTranslator.ConvertToProfileEntity(user); profileManager.Update(userEntity); } }
public void Add(ProfileContract profile) { using (var dbConnector = new DBConnector()) { ProfileManager profileManager = new ProfileManager(dbConnector.DataContext); var profileEntity = ProfilesTranslator.ConvertToProfileEntity(profile); profileManager.Add(profileEntity); } }
public List <ProfileContract> GetAll() { using (var dbConnector = new DBConnector()) { ProfileManager profileManager = new ProfileManager(dbConnector.DataContext); var profiles = profileManager.GetAll(); return(ProfilesTranslator.ConvertToProfileContract(profiles).ToList()); } }
public ProfileContract GetById(int profileId) { using (var dbConnector = new DBConnector()) { ProfileManager profileManager = new ProfileManager(dbConnector.DataContext); var profile = profileManager.GetById(profileId); return(ProfilesTranslator.ConvertToProfileContract(profile)); } }