public async Task <bool> DeleteTagAsync([Service] TestSystemDbContext context, Guid id) { var state = context.Tags.Remove(await context.Tags.FindAsync(id)).State; await context.SaveChangesAsync(); return(state == EntityState.Deleted ? true : false); }
public async Task <Tag> UpdateTagAsync([Service] TestSystemDbContext context, Tag updateTag) { var tag = context.Tags.Update(updateTag); await context.SaveChangesAsync(); return(tag.Entity); }
public AccountService(TestSystemDbContext context, UserManager <User> userManager, SignInManager <User> signInManager) { _context = context; _userManager = userManager; _signInManager = signInManager; }
public async Task <Test> UpdateTestAsync([Service] TestSystemDbContext context, Test updateTest) { var test = context.Tests.Update(updateTest); await context.SaveChangesAsync(); return(test.Entity); }
public async Task <Question> UpdateQuestionAsync([Service] TestSystemDbContext context, Question updateQuestion) { var question = context.Update(updateQuestion); await context.SaveChangesAsync(); return(question.Entity); }
public async Task <Question> CreateQuestionAsync([Service] TestSystemDbContext context, Question questionInput) { var question = await context.Questions.AddAsync(questionInput); await context.SaveChangesAsync(); return(question.Entity); }
public async Task <bool> RemoveQuestionsAsync([Service] TestSystemDbContext context, TestQuestionRelation testQuestions) { testQuestions.TestsQuestions.ToList().ForEach(x => x.TestId = testQuestions.TestId); context.TestQuestion.RemoveRange(testQuestions.TestsQuestions); await context.SaveChangesAsync(); return(true); }
public async Task <bool> RemoveTagsAsync([Service] TestSystemDbContext context, TagQuestionRelation tagQuestion) { tagQuestion.QuestionsTags.ToList().ForEach(x => x.QuestionId = tagQuestion.QuestionId); context.QuestionTag.RemoveRange(tagQuestion.QuestionsTags); await context.SaveChangesAsync(); return(true); }
public async Task <Tag> CreateTagAsync([Service] TestSystemDbContext context, Tag inputTag) { var tag = await context.Tags.AddAsync(inputTag); await context.SaveChangesAsync(); return(tag.Entity); }
public async Task <bool> AddTagsAsync([Service] TestSystemDbContext context, TagTestRelation tagTest) { tagTest.TestsTags.ToList().ForEach(x => x.TestId = tagTest.TestId); context.TestTag.AddRange(tagTest.TestsTags); await context.SaveChangesAsync(); return(true); }
public async Task <Test> CreateTestAsync([Service] TestSystemDbContext context, Test testInput) { testInput.CreateDate = DateTime.Now; var test = context.Tests.Add(testInput); await context.SaveChangesAsync(); return(test.Entity); }
public async Task <bool> DeleteQuestionAsync([Service] TestSystemDbContext context, Guid id) { var state = context.Questions.Remove(await context.Questions.FindAsync(id)).State; await context.SaveChangesAsync(); var result = state == EntityState.Deleted ? true : false; return(result); }
public void TestSignInValidUser(string email, string password) { var loginUserModel = new LoginModel() { Email = email, Password = password }; var options = SetUpInMemoryDbOptions(); using (var context = new TestSystemDbContext(options)) { } }
public async Task <Result> GetResultAsync([Service] TestSystemDbContext context, Guid id) { return(await context.Results.FindAsync(id)); }
public async Task <Question> GetQuestionAsync([Service] TestSystemDbContext context, Guid id) { return(await context.Questions.FindAsync(id)); }
public async Task <IEnumerable <Question> > GetQuestionsAsync([Service] TestSystemDbContext context) { return(await context.Questions.ToListAsync()); }
public async Task <Tag> GetTagAsync([Service] TestSystemDbContext context, Guid id) { return(await context.Tags.FindAsync(id)); }
public async Task <IEnumerable <Tag> > GetTagsAsync([Service] TestSystemDbContext context) { return(await context.Tags.ToListAsync()); }
public async Task <IEnumerable <Result> > GetResultsAsync([Service] TestSystemDbContext context) { return(await context.Results.ToListAsync()); }