private async Task CreateProfilePropertyInDb(UserProfileProperty userProfileProperty, ProfilePropertyVisibility visibility) { using (var uow = new UnitOfWork(Context)) { var repo = new UserProfilePropertyRepository(uow); await repo.CreateWithData(userProfileProperty, visibility); } }
public async Task <UserProfileProperty> CreateWithData(UserProfileProperty entity, ProfilePropertyVisibility visibility) { var dbRecord = new UserProfile { UserId = entity.UserId, PropertyDefinitionId = entity.ProfilePropertyId, PropertyValue = entity.Value, LastUpdatedDate = DateTime.UtcNow, Visibility = (int)visibility }; Uow.DbContext.UserProfile.Add(dbRecord); await Uow.SaveChanges(); return(Translate(dbRecord)); }