示例#1
0
        private static void CreateProfileExample()
        {
            var userId = AskFor <string>("Enter a User Id for the new profile: ");

            if (profileCreate == null)
            {
                profileCreate = new ProfileCreate(consumerKey, consumerSecret);
            }

            var response = profileCreate.GetResponseSynchronously(new ProfileCreateRequest()
            {
                UserId = userId
            });

            if (response != null && response.profile != null)
            {
                Console.WriteLine("Profile Created Successfully: ");
                Console.WriteLine("Token: " + response.profile.auth_token);
                Console.WriteLine("Secret: " + response.profile.auth_secret);
            }
            else
            {
                Console.WriteLine("Problem creating profile.");
            }
        }
示例#2
0
        public string CreateUser(ProfileCreate model)
        {
            var checkForUserName = GetByUsername(model.Username);

            if (checkForUserName.Username != null)
            {
                return("username taken");
            }

            var entity = new Profile()
            {
                ID             = _userId,
                Username       = model.Username,
                FirstName      = model.FirstName,
                LastName       = model.LastName,
                City           = model.City,
                State          = (Data.StateName)model.State,
                ZipCode        = model.ZipCode,
                ProfilePicture = model.GetProfilePicture,
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Profiles.Add(entity);
                ctx.SaveChanges();
                return("okay");
            }
        }
        public ActionResult Create(ProfileCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var    service = CreateProfileService();
            string result  = service.CreateUser(model);

            if (result == "okay")
            {
                TempData["SaveResult"] = "Your profile was created.";
                return(RedirectToAction("Index"));
            }
            ;

            if (result == "username taken")
            {
                ModelState.AddModelError("", "Username not available.");
                TempData["SaveResult"] = "Profile not created.";
                return(View(model));
            }
            ;
            ModelState.AddModelError("", "Profile could not be created.");

            return(View(model));
        }
示例#4
0
        public async Task <ProfileCreateResponse> Create([FromBody] ProfileCreate profileCreate)
        {
            var patient = await registeredPatientBussiness.Create(profileCreate);

            var token = tokenGenerator.GenerateToken(patient.QRCode.FormatAsString(), Role.Patient).Token;

            return(new ProfileCreateResponse()
            {
                QRCode = patient.QRCode,
                Token = token
            });
        }
        public ActionResult Create(ProfileCreate profile)
        {
            if (!ModelState.IsValid)
            {
                return(View(profile));
            }

            IProfileDAC dac = new ProfileDAC();

            dac.Add(profile.Name, profile.ProfileText, profile.SortOrder);
            return(RedirectToAction("Index"));
        }
        public async Task <RegisteredPatient> Create(ProfileCreate profileCreate)
        {
            var registeredPatient = profileCreate.ConvertTo <RegisteredPatient>();

            registeredPatient.Password    = registeredPatient.Password.Encode();
            registeredPatient.QRCode      = Guid.NewGuid();
            registeredPatient.CreatedDate = DateTime.Now;

            AddEntry(registeredPatient);
            await SaveChangesAsync();

            return(registeredPatient);
        }
示例#7
0
        //Post
        public bool CreateProfile(ProfileCreate model)
        {
            Profile entity = new Profile
            {
                ProfileId = _userId,
                FirstName = model.FirstName,
                LastName  = model.LastName,
                Email     = model.Email,
                UserName  = model.UserName
            };

            _context.Profiles.Add(entity);
            return(_context.SaveChanges() == 1);
        }
示例#8
0
        public bool CreateProfile(ProfileCreate model)
        {
            var entity =
                new Profile()
            {
                //CategoryTitle = model.CategoryTitle,
                //Profile properties
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Profile.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
示例#9
0
        // Post - Create
        public bool CreateProfile(ProfileCreate model)
        {
            var entity =
                new Profile
            {
                FirstName  = model.FirstName,
                LastName   = model.LastName,
                Motivation = model.Motivation
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Profiles.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
示例#10
0
        public bool CreateProfile(ProfileCreate model)
        {
            var entity =
                new Profile()
            {
                OwnerId = _userId,
                Name    = model.Name,
                Summary = model.Summary,
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Profiles.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
示例#11
0
        public ActionResult Create(ProfileCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var service = GetProfileService();

            if (service.CreateProfile(model))
            {
                return(RedirectToAction(nameof(Index)));
            }

            return(View(model));
        }
示例#12
0
        public IHttpActionResult Post(ProfileCreate profile)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var service = CreateProfileService();

            if (!service.CreateProfile(profile))
            {
                return(InternalServerError());
            }

            return(Ok());
        }
        public bool CreateProfile(ProfileCreate model)
        {
            var entity =
                new Profile()
            {
                OwnerId         = _userId,
                EmployeeId      = model.EmployeeId,
                QualificationId = model.QualificationId,
                CreatedUtc      = DateTimeOffset.Now
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Profiles.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
示例#14
0
        public bool CreateProfile(ProfileCreate model)
        {
            var entity =
                new Profile()
            {
                UserID     = _userID,
                Name       = model.Name,
                Email      = model.Email,
                CreatedUtc = DateTimeOffset.Now
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Profiles.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
示例#15
0
        public bool CreateProfile(ProfileCreate model)
        {
            var entity =
                new Profile()
            {
                Id          = _userId,
                ProfileName = model.ProfileName,
                Phone       = model.Phone,
                Email       = model.Email,
                Rating      = model.Rating,
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Profiles.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
示例#16
0
        public bool CreateProfile(ProfileCreate model)
        {
            var entity =
                new Profile()
            {
                OwnerID    = _userId,
                FirstName  = model.FirstName,
                LastName   = model.LastName,
                FavTeam    = model.FavTeam,
                CreatedUtc = DateTimeOffset.Now
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Profiles.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
示例#17
0
        public ActionResult Create(ProfileCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var service = CreateProfileService();

            if (service.CreateProfile(model))
            {
                TempData["SaveResult"] = "Your profile was successfully created.";
                return(RedirectToAction("Index"));
            }
            ;

            ModelState.AddModelError("", "Profile could not be created, please try again.");
            return(View(model));
        }
示例#18
0
        public bool CreateProfile(ProfileCreate model)
        {
            var entity =
                new Profile()
            {
                ProfileId         = model.ProfileId,
                UserName          = model.UserName,
                StartDate         = model.StartDate,
                MembershipLevel   = model.MembershipLevel,
                RenewalDate       = model.RenewalDate,
                Email             = model.Email,
                ContactPreference = model.ContactPreference,
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Profile.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
示例#19
0
        public bool CreateProfile(ProfileCreate model)
        {
            var entity =
                new Profile()
            {
                UserID          = _userID,
                FirstName       = model.FirstName,
                LastName        = model.LastName,
                Birthday        = model.Birthday,
                Email           = model.Email,
                PhoneNumber     = model.PhoneNumber,
                OtherInfo       = model.OtherInfo,
                AthleteUsername = model.AthleteUsername,
                MyTeams         = model.MyTeams,
                Comments        = new List <Comment>(),
                CreatedUtc      = model.CreatedUtc
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Profile.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
示例#20
0
        public ProfilePrediction Post(ProfileCreate request)
        {
            var dueDate = repo.DueDates.GetById(1);

            string emailCode = getUniqueCode();

            // determine if they have already signed up
            Profile profile = repo.Profiles.GetByEmailAddress(request.EmailAddress);
            // if they have send them an email telling them how to
            if (profile != null)
            {
                notify.SendAuth(profile, dueDate);
                Response.StatusCode = 401;
                return null;
            }

            // if they are a new person, lets create a new profile for them
            profile = repo.Profiles.Create(new Profile { EmailCode = emailCode }.PopulateWithNonDefaultValues(request));

            repo.Predictions.Create(new Prediction { ProfileId = profile.Id, DueDateId = dueDate.Id });

            notify.SendAuth(profile, dueDate);

            // store profile Id in session and set a long lasting cookie associated with the profile
            setProfileSession(profile);

            return getAggregate(profile);
        }