public RedirectToRouteResult CreatePoll(QuestionType questionType, Poll poll, Location location) { poll.Questions = new List<Question>(); poll.CreationLocation = LocationUtil.ParseLocation(location); this.Session[PollKey] = poll; return this.GoToCreateQuestion(questionType); }
private void CreatePoll(AppDbContext context) { var multiple = new MultipleChoicesQuestion { Type = QuestionType.MultipleChoices, Statement = "multiple choices", CanSelectMultiple = true, Choices = new List<Choice> { new Choice { Text = "11111" }, new Choice { Text = "22222" }, new Choice { Text = "33333" } } }; var freeText = new Question { Statement = "free text", Type = QuestionType.FreeText }; var poll = new Poll { Name = "agora vai", Range = 50, CreationDate = DateTime.Now, ExpirationDate = new DateTime(2020, 01, 01), CreationLocation = new Location { Latitude = 90.0f, Longitude = 50.0f }, Questions = new List<Question> { multiple, freeText }, }; context.Polls.Add(poll); context.SaveChanges(); }