public void CreateAccount(CollaborateurModel item)
        {
            var user = new ApplicationUser { UserName = item.Email, Email = item.Email };
            var result= UserManager.Create(user, item.Password);

            var currentUser = UserManager.FindByName(item.Email);
                var roleresult = UserManager.AddToRole(currentUser.Id, item.Role);
                ajt_collaborator entity = Mapper.Map<CollaborateurModel, ajt_collaborator>(item);
                entity.id_user_fk = currentUser.Id;
                entity.deletion_date = null;

                repo.CreateCollaborator(entity);
        }
 public bool ValidateCollaborateur(CollaborateurModel item)
 {
     if (item.Username == null || item.Email == null) return false;
     if (UserManager.FindByEmail(item.Email) != null) return false;
     if (item.Password.Any(".,;_-+/!@#$%^&*".Contains) && item.Password.Any(char.IsDigit) && item.Password.Any(char.IsLower) && item.Password.Any(char.IsUpper))
     {
         return ModelState.IsValid;
     }
     else {
         return false;
     }
 }
 public bool ValidateCollaborateurEdition(CollaborateurModel item)
 {
     bool result = (item.Nom == null) || (item.Prenom == null) || (item.address == null);
     return !result;
 }
 public void UpdateAccount(CollaborateurModel item)
 {
     ApplicationUser user = UserManager.FindByIdAsync(item.id_user_fk).Result;
         user.Roles.Clear();
         UserManager.AddToRoleAsync(item.id_user_fk, item.Role);
         ajt_collaborator entity = repo.GetCollaboratorById(item.id);
         entity.id_user_fk = item.id_user_fk;
         entity.marital_status = item.marital_status;
         entity.Nom = item.Nom;
         entity.Prenom = item.Prenom;
         entity.address = item.address;
         repo.UpdateCollaborateur(entity);
 }