/// <summary> /// Deprecated Method for adding a new object to the Surveys EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToSurveys(Survey survey) { base.AddObject("Surveys", survey); }
public async Task SeedAsync() { await _context.Database.MigrateAsync().ConfigureAwait(false); if (!await _context.Users.AnyAsync()) { const string adminRoleName = "administrator"; const string userRoleName = "user"; await ensureRoleAsync(adminRoleName, "Default administrator", ApplicationPermissions.GetAllPermissionValues()); await ensureRoleAsync(userRoleName, "Default user", new string[] { }); await createUserAsync("admin", "tempP@ss123", "Inbuilt Administrator", "*****@*****.**", "+1 (484) 000-0000", new string[] { adminRoleName }); await createUserAsync("user", "tempP@ss123", "Inbuilt Standard User", "*****@*****.**", "+1 (484) 000-0001", new string[] { userRoleName }); } if (!await _context.Participant.AnyAsync() && !await _context.Survey.AnyAsync()) { Participant participantInitvals = new Participant { FirstName = "test1", LastName = "test1", EmailAddress = "*****@*****.**", Password = "", PhoneNumber = "1234567890", City = "exton", State = "pa", Zip = "19341", GenderIdentity = "male", SexualOrientation = "same sex", OtherGenderType = "", OtherSexualOrientation = "", Race = "", Hispanic = "", Age = "69", Date_of_Birth = DateTime.Now.Date, //From ScoreModel.cs AgeValid = true, StateValid = true, CityValid = true, FirstName_Match = true, LastName_Match = true, Gender_Match = true, Verified = true, FinalScaoreVal = 100, //map GeoLocProps.cs geo_IP = "123.89.08.09", geo_CountryName = "usa", geo_RegionName = "philly", geo_City = "philly", geo_ZipCode = "12345", //map userAgent Class Browser = "mozilla", OS = "windows" }; Survey newsurvey = new Survey { Survey_Name = "survey01", Survey_Active = true, RedirectingUrl = "www.google.com" }; _context.Participant.Add(participantInitvals); _context.Survey.Add(newsurvey); await _context.SaveChangesAsync(); } }
/// <summary> /// Create a new Survey object. /// </summary> /// <param name="surveyID">Initial value of the SurveyID property.</param> /// <param name="createDate">Initial value of the CreateDate property.</param> /// <param name="portalID">Initial value of the PortalID property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="isDeleted">Initial value of the IsDeleted property.</param> public static Survey CreateSurvey(global::System.Int32 surveyID, global::System.DateTime createDate, global::System.Int32 portalID, global::System.String name, global::System.Boolean isDeleted) { Survey survey = new Survey(); survey.SurveyID = surveyID; survey.CreateDate = createDate; survey.PortalID = portalID; survey.Name = name; survey.IsDeleted = isDeleted; return survey; }