public static Profile CreateApplicantProfile(Account account) { Profile profile = new Profile() { trailHeadUrl = "trailhead.me/id/" + account.userID, careerPath = "n/a", careerPathCompletion = "0", Account = account }; return(Repository.CreateProfile(profile)); }
public ActionResult CreateProfile(ProfileViewModel profileViewModel) { profileViewModel.ProfileUsers = JsonConvert.DeserializeObject <IEnumerable <ProfileUser> >(Request["ProfileUsers"]); // Create new profile var profile = profileViewModel.ToProfileDetails(); profile.SetDefaultValues(); var userName = UserDetails.CurrentUser().Name; int newProfileId = _profileRepository.CreateProfile(profile); // New domain _writer.NewGroupingMetadata(profile.DefaultDomainName, 1, newProfileId); // Create default content items new DefaultProfileContentWriter(_writer, newProfileId, userName) .CreateContentItems(); return(RedirectToAction("ManageProfiles")); }
public async void CreateProfileTest() { var options = new DbContextOptionsBuilder <BefordingTestContext>() .UseInMemoryDatabase(databaseName: "BefordingTestDb") .Options; var context = new BefordingTestContext(options); var repository = new ProfileRepository(context, _userInfoServiceMock.Object, _logRepositoryMock.Object); var dummyHospitalVM = new HospitalProfileVM() { Address = "a", NameOfHospital = "UUU", Rate = 1 }; var result = await repository.CreateProfile(dummyHospitalVM); Assert.True(result.GetType() == typeof(HospitalProfile)); Assert.True(result.Id == 1); }