private ProfileContract FillProfileData() { ProfileContract newProfile = new ProfileContract() { UserID = CurrentUser.UserID, CompanyName = txtCompanyName.Value, Description = txtDescription.Value, LinkedURL = txtLinkedInUrl.Value, YouTubeURL = txtYouTubeUrl.Value, PreviousWork = txtPreviousWork.Value, Experience = (int)float.Parse(txtExperience.Value), SubCategoryID = 1 }; var image1 = loadImage(image1Upload, newProfile.ProfileID); var image2 = loadImage(image2Upload, newProfile.ProfileID); var image3 = loadImage(image3Upload, newProfile.ProfileID); //newProfile.Images = new List<ImageContract>(); //newProfile.Images.Add(image1); //newProfile.Images.Add(image2); // newProfile.Images.Add(image3); return(newProfile); }
public static Profile ConvertToProfileEntity(ProfileContract profile) { if (profile == null) { return(null); } Profile entityProfile = new Profile() { ProfileID = profile.ProfileID, UserID = profile.UserID, Description = profile.Description, Experience = profile.Experience, LinkedURL = profile.LinkedURL, YouTubeURL = profile.YouTubeURL, PreviousWork = profile.PreviousWork, Rating = profile.Rating, Featured = profile.Featured, CompanyName = profile.CompanyName, SubCategoryID = profile.SubCategoryID, ExpiryDate = profile.ExpiryDate, ViewersCount = profile.ViewersCount, }; return(entityProfile); }
private void SaveProfile(ProfileContract profile) { FreeLancersEntities entities = new FreeLancersEntities(); ProfileManager profileManager = new ProfileManager(entities); var profileEntity = ProfilesTranslator.ConvertToProfileEntity(profile); profileManager.Add(profileEntity); }
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 static ProfileContract ConvertToProfileContract(Profile profile, bool includeImages) { ProfileContract contractProfile = new ProfileContract() { ProfileID = profile.ProfileID, UserID = profile.UserID, Description = profile.Description, Experience = profile.Experience, LinkedURL = profile.LinkedURL, YouTubeURL = profile.YouTubeURL, PreviousWork = profile.PreviousWork, Rating = profile.Rating, Featured = profile.Featured, CompanyName = profile.CompanyName, SubCategoryID = profile.SubCategoryID, Images = profile.Images != null?ImagesTranslator.ConvertToImageContract(profile.Images) : null }; return(contractProfile); }