public void PopulateTopicsDropDownList(StudyFriendContext _context, object selectedTopic = null) { var userId = User.FindFirstValue(ClaimTypes.NameIdentifier); var topicsQuery = from t in _context.Topic where t.UserId == userId orderby t.Name select t; TopicNameSL = new SelectList(topicsQuery.AsNoTracking(), "TopicID", "Name", selectedTopic); }
public void PopulateQuestionsDropDownList(StudyFriendContext _context, object selectedQuestion = null) { var userId = User.FindFirstValue(ClaimTypes.NameIdentifier); var questionsQuery = from q in _context.Question join t in _context.Topic on q.TopicID equals t.TopicID where t.UserId == userId select q; QuestionBodySL = new SelectList(questionsQuery.AsNoTracking(), "QuestionID", "Body", selectedQuestion); }
public void FindTopic_ByUserId() { using (var db = new StudyFriendContext(Utilities.TestDbContextOptions())) { string user_id = "test_id"; var topics = new Topic[] { new Topic { Name = "JavaScript", UserId = user_id } }; foreach (Topic t in topics) { db.Topic.Add(t); } db.SaveChanges(); var topic = (from t in db.Topic where t.UserId == user_id select t).Single(); Assert.Equal(topic.UserId, user_id); } }
public CreateModel(StudyFriendContext context) { _context = context; }
public DetailsModel(StudyFriendContext context) { _context = context; }
public IndexModel(StudyFriendContext context) { _context = context; }
public IndexModel(StudyFriendContext context, UserManager <ApplicationUser> userManager) { _context = context; _userManager = userManager; }
public DeleteModel(StudyFriendContext context) { _context = context; }
public EditModel(StudyFriendContext context) { _context = context; }