public async Task SetInitialDataAsync(PersonAbstractDTO PersonDto, List <string> roles) { foreach (string roleName in roles) { var role = await identity.RoleManager.FindByNameAsync(roleName); if (role == null) { role = new ApplicationRole { Name = roleName }; await identity.RoleManager.CreateAsync(role); } } if (PersonDto is UserDTO) { await kernel.Get <IUserService>().CreateUserAsync((UserDTO)PersonDto, new UserMessageSpecification().ToSuccessCreateMessage(), new UserMessageSpecification().ToFailCreateMessage()); } else { await kernel.Get <IEmployeeService>().CreateEmployeeAsync((EmployeeDTO)PersonDto, new EmployeeMessageSpecification().ToSuccessCreateMessage(), new EmployeeMessageSpecification().ToFailCreateMessage()); } }
public PersonPropertyViewModel(AbstractPersonViewModel <T> userViewModel) { PersonModel = userViewModel.Person as PersonAbstractDTO; AddressViewModel = AddressViewModel ?? new AddressPropertyViewModel(userViewModel.AddressView); InsertComboboxPersonInformation(PersonModel); AddressViewModel.InsertComboboxAddressInformation(userViewModel.AddressView); }
public void InsertComboboxPersonInformation(PersonAbstractDTO person) { TbName = person.Name; TbSurname = person.Surname; TbPatronumic = person.Patronumic; TbPassport = person.PassportNumber; TbPhoneNumber = person.PhoneNumber; TbEmail = person.Email; }
public async Task <string> AuthenticateAsync(PersonAbstractDTO PersonDto) { string Auth = ""; ApplicationUser user = await identity.AppUserManager.FindAsync(PersonDto.Email, PersonDto.Password); if (user != null) { Auth = user.Id; } return(Auth); }
public async Task <ClaimsIdentity> AuthenticateAsync(PersonAbstractDTO PersonDto) { ClaimsIdentity claim = null; ApplicationUser user = await identity.AppUserManager.FindAsync(PersonDto.Email, PersonDto.Password); if (user != null) { claim = await identity.AppUserManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie); } return(claim); }
public async Task SetInitialDataAsync(PersonAbstractDTO PersonDto, List <string> roles) { await new AuthentificationHttpService(kernel).SetInitialDataAsync(PersonDto, roles); }