public void AddProblem(string name, int points) { db.Problems.Add(new Problem { Name = name, Points = points, }); db.SaveChanges(); }
public void Create(string problemId, string userId, string code) { var problemMaxpoints = db .Problems .Where(x => x.Id == problemId) .Select(x => x.Points) .FirstOrDefault(); db.Submissions .Add(new Submission { ProblemId = problemId, UserId = userId, Code = code, CreatedOn = DateTime.UtcNow, AchievedResult = random.Next(0, problemMaxpoints + 1), }); db.SaveChanges(); }
public void CreateProblem(string name, int points, string userId) { var problem = new Problem { Name = name, Points = points, UserId = userId }; dbContext.Problems.Add(problem); dbContext.SaveChanges(); }
public void UserRegistration(string username, string email, string password) { var hashPassword = Hash(password); var user = new User { Username = username, Email = email, Password = hashPassword, }; db.Users.Add(user); db.SaveChanges(); }