/// <summary> /// This EndPoint create an User of the role Specified /// </summary> /// <param name="user">user to create</param> /// <returns>status code 200</returns> public void AddUser(User user) { try { int result = _iUserDAO.GetUserByUserName(user.UserName); if (result == 0) { int id = _iUserDAO.AddUser(user); if (user.Role.Equals("Admin")) { _iAdminDAO.AddAdmin(id); } else if (user.Role.Equals("Maestro")) { _iTeacherDAO.AddTeacher(id); } else if (user.Role.Equals("Alumno")) { _iStudentDAO.AddStudent(id); } } else { throw new ArgumentException("This user already exists"); } } catch (Exception e) { throw e; } }