Ejemplo n.º 1
0
        public async Task UpdateAsync(EditViewModel viewModel)
        {
            StudentDTOBuilderData builderData = new StudentDTOBuilderData(viewModel);
            StudentDTO            newStudent  = dtoFactory.CreateDTO <StudentDTOBuilderData, StudentDTO>(builderData);

            studentService.UpdateStudentsBaseInfo(newStudent);
            await studentService.SaveChangesAsync();
        }
Ejemplo n.º 2
0
        public async Task <IdentityResult> CreateAsync(CreateViewModel viewModel)
        {
            StudentDTOBuilderData builderData = new StudentDTOBuilderData(viewModel);
            StudentDTO            newStudent  = dtoFactory.CreateDTO <StudentDTOBuilderData, StudentDTO>(builderData);

            IdentityResult result = await userManager.CreateAsync(newStudent, viewModel.Password);

            if (result.Succeeded)
            {
                IdentityResult roleResult = userManager.AddToRole(newStudent.Id, "Student");
            }
            return(result);
        }