/// <summary> /// Deprecated Method for adding a new object to the Profiles EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToProfiles(Profile profile) { base.AddObject("Profiles", profile); }
private Profile CreateProfile(string userName, string passWord, string description, string firstName, string lastName) { //Opret login information Credential credential = (string.IsNullOrWhiteSpace(firstName) && string.IsNullOrWhiteSpace(lastName)) ? CredentialService.Create(userName, passWord) : CredentialService.Create(userName, passWord, firstName, lastName); //Opret profil Profile profile = new Profile() { CredentialsId = credential.CredentialsId, Description = description }; //Tilføj grunkers profile.Grunkers.Add(new Grunker { Sum = 1500 }); //Tikføj aktivitet til profilen profile.ProfileActivities.Add(new ProfileActivity(GetActivityByName("Created").ActivityTypeId)); //Gem i databasen ProfileRepository.Create(profile); return profile; }
/// <summary> /// Create a new Profile object. /// </summary> /// <param name="profileId">Initial value of the ProfileId property.</param> /// <param name="description">Initial value of the Description property.</param> /// <param name="credentialsId">Initial value of the CredentialsId property.</param> public static Profile CreateProfile(global::System.Int32 profileId, global::System.String description, global::System.Int32 credentialsId) { Profile profile = new Profile(); profile.ProfileId = profileId; profile.Description = description; profile.CredentialsId = credentialsId; return profile; }
public void UploadResizeAndSave(ref Profile profile, HttpPostedFileBase image = null) { string fileName = Guid.NewGuid() + Path.GetExtension(image.FileName); if (image != null) { image.SaveAs(HttpContext.Current.Server.MapPath("~/Content/Uploads/Temp/" + fileName)); } try { foreach (var size in PictureSizes.Profiles) { string nPath, nFileName; PictureService.ResizeAndSave("~/Content/Uploads/Temp/", fileName, size.Width, size.Height, out nPath, out nFileName); ProfileRepository.AddPicture(profile.ProfileId, nPath, nFileName, size.Width, size.Height); } } finally { if (image != null) { File.Delete(HttpContext.Current.Server.MapPath("~/Content/Uploads/Temp/" + fileName)); } } }