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")); }
public SignUpStudentHandler( IStudentAccountService studentAccountService, IMapper mapper) { _studentAccountService = studentAccountService; _mapper = mapper; }
public SchoolHelperManager() { _studentAccountRepository = new StudentAccountService(); _teacherAccountRepository = new TeacherAccountService(); }
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()); }