public void SuspendUser(int userID, DateTime since) { Ban ban = new Ban { UserID = userID, Until = since }; _context.Add(ban); _context.SaveChanges(); }
private void Create(int studentID, string teacherName, string message, string subjectTitle) { string studentName = GetStudentNameById(studentID); string validationMessage; bool isValid = ValidateData(studentName, teacherName, message, subjectTitle, out validationMessage); if (isValid) { Question question = new Question { TeacherName = Encryptor.Encrypt(teacherName), Message = message, StudentName = studentName, Answer = "Not answered yet", Status = 0, SubjectTitle = subjectTitle }; _context.Add(question); _context.SaveChanges(); } else { throw new ArgumentException(validationMessage); } }
private void Create(string username, string password, string profession) { User user = new User { Nick = Encryptor.Encrypt(username), Password = Encryptor.Encrypt(password), Profession = profession, }; _context.Add(user); _context.SaveChanges(); }