public async Task InsertContent(ExternalContentDto newContent) { _context.ExternalContent.Add(new ExternalContent { Title = newContent.Title, Url = newContent.Url, Order = newContent.Order, }); await _context.SaveChangesAsync(); }
public async Task <int> CreateProfile(ProfileRequestDto profileInfo) { var profile = new Profile { UserId = profileInfo.UserId, FirstName = profileInfo.FirstName, LastName = profileInfo.LastName, Email = profileInfo.Email, }; _context.Profiles.Add(profile); await _context.SaveChangesAsync(); return(profile.Id); }
public async Task LevelCompleted(int profileId, int levelId, bool correct) { var progress = await GetProgressForLevel(profileId, levelId); if (progress.Correct) { // Don't store anything if the user has already completed the challenge return; } progress.Attempts++; if (correct) { progress.Correct = true; } await _context.SaveChangesAsync(); }