Ejemplo n.º 1
0
        public async Task <IActionResult> Register([FromServices] IStudentAccountService studentAccountService, [FromServices] ITeacherAccountService teacherAccountService, string name, string surname, string email, string username, string password, int age, int gender, int accountType)
        {
            IAccount account = new Account
            {
                Password = password,
                UserName = username,
                Status   = (Status)accountType,
                User     = new User
                {
                    GenderType = (Gender)gender,
                    Age        = age,
                    Surname    = surname,
                    Mail       = email,
                    Name       = name,
                }
            };

            if (account.Status == Status.Student)
            {
                await studentAccountService.AddStudentAccountDbAsync(account.Map <IAccount, IStudentAccount>());
            }
            else
            {
                await teacherAccountService.AddTeacherAccountDbAsync(account.Map <IAccount, ITeacherAccount>());
            }

            return(RedirectToAction("Login"));
        }
Ejemplo n.º 2
0
 public SignUpStudentHandler(
     IStudentAccountService studentAccountService,
     IMapper mapper)
 {
     _studentAccountService = studentAccountService;
     _mapper = mapper;
 }
Ejemplo n.º 3
0
 public SchoolHelperManager()
 {
     _studentAccountRepository = new StudentAccountService();
     _teacherAccountRepository = new TeacherAccountService();
 }
Ejemplo n.º 4
0
        public async Task <IActionResult> Index([FromServices] ITeacherAccountService teacherAccountService, [FromServices] IStudentAccountService studentAccountService)
        {
            var TeacherAccs = await teacherAccountService.GetTeacherAccountsFromDbAsync();

            var StudentAccs = await studentAccountService.GetStudentAccountsFromDbAsync();

            int[] numbers = { TeacherAccs.Count(), StudentAccs.Count() };
            ViewBag.Message = numbers;
            return(View());
        }