Exemple #1
0
        public Task <Execute <TicketEntity> > SignUpAsync(SignUpExternalEntity signUp)
        {
            var result = new Execute <TicketEntity>(new TicketEntity
            {
                Culture = "en-US",
                Key     = "123".ToGuid(),
                Name    = "Márvio André",
                Status  = TicketStatus.Sucess
            });

            return(Task.FromResult(result));
        }
 public virtual async Task <Execute <TicketEntity> > SignUp([FromBody] SignUpExternalEntity signUp)
 {
     return(await LoginBusiness.SignUpAsync(signUp));
 }
Exemple #3
0
        public override SignUpExternalEntity ParseExternalEntity(OAuthCreatingTicketContext ctx)
        {
            var signUp = new SignUpExternalEntity
            {
                Provider = ProviderType.Google
            };

            var id = ctx.User.Value <string>("id");

            if (id.IsNotEmpty())
            {
                signUp.Token      = id;
                signUp.Identifier = id;
            }

            var name = ctx.User.Value <string>("displayName");

            if (name.IsNotEmpty())
            {
                signUp.Name = name;
            }

            var email = ctx.User["emails"]?[0]?["value"]?.ToString();

            if (email.IsNotEmpty())
            {
                signUp.Email = email;
            }

            var gender = ctx.User.Value <string>("gender");

            if (gender.IsNotEmpty())
            {
                signUp.Male = gender.ToLower() == "male";
            }

            var urlProfile = ctx.User.Value <string>("url");

            if (urlProfile.IsNotEmpty())
            {
                signUp.UrlProfile = urlProfile;
            }

            var urlImage = ctx.User["image"]?["url"]?.ToString();

            if (urlImage.IsNotEmpty())
            {
                signUp.UrlImage = urlImage.Replace("?sz=50", string.Empty);
            }

            var urlCover = ctx.User["cover"]?["coverPhoto"]?["url"]?.ToString();

            if (urlCover.IsNotEmpty())
            {
                signUp.UrlCover = urlCover;
            }

            var language = ctx.User.Value <string>("language");

            if (language.IsNotEmpty())
            {
                signUp.Language = language;
            }

            return(signUp);
        }