public EFMusicRepository(EFDbContext context)
 {
     this.context = context;
 }
 public CandidateRepository(EFDbContext context)
 {
     this.context = context;
 }
 public EFUsersRepository(EFDbContext context)
 {
     this.context = context;
 }
 public AgitatorPrecinctRelationRepository(EFDbContext context)
 {
     this.context = context;
 }
 public StreetRepository(EFDbContext context)
 {
     this.context = context;
 }
 public HouseRepository(EFDbContext context)
 {
     this.context = context;
 }
 public WorkerRepository(EFDbContext context)
 {
     this.context = context;
 }
 public CandidateMunicipalityRelationRepository(EFDbContext context)
 {
     this.context = context;
 }
 public RegistrationRepository(EFDbContext context)
 {
     this.context = context;
 }
 public EFPostRepository(EFDbContext context)
 {
     this.context = context;
 }
 public PersonRelationRepository(EFDbContext context)
 {
     this.context = context;
 }
        public ActionResult ExternalLoginConfirmation(RegisterExternalLoginModel model, string returnUrl)
        {
            string provider = null;
            string providerUserId = null;

            if (User.Identity.IsAuthenticated || !OAuthWebSecurity.TryDeserializeProviderUserId(model.ExternalLoginData, out provider, out providerUserId))
            {
                return RedirectToAction("Manage");
            }

            if (ModelState.IsValid)
            {
                // Добавление нового пользователя в базу данных
                using (EFDbContext db = new EFDbContext())
                {
                    UserProfile user = db.UserProfiles.FirstOrDefault(u => u.UserName.ToLower() == model.UserName.ToLower());
                    // Проверка наличия пользователя в базе данных
                    if (user == null)
                    {
                        // Добавление имени в таблицу профиля
                        db.UserProfiles.Add(new UserProfile { UserName = model.UserName });
                        db.SaveChanges();

                        OAuthWebSecurity.CreateOrUpdateAccount(provider, providerUserId, model.UserName);
                        OAuthWebSecurity.Login(provider, providerUserId, createPersistentCookie: false);

                        return RedirectToLocal(returnUrl);
                    }
                    else
                    {
                        ModelState.AddModelError("UserName", "Имя пользователя уже существует. Введите другое имя пользователя.");
                    }
                }
            }

            ViewBag.ProviderDisplayName = OAuthWebSecurity.GetOAuthClientData(provider).DisplayName;
            ViewBag.ReturnUrl = returnUrl;
            return View(model);
        }
Example #13
0
 public GEORepository(EFDbContext context)
 {
     this.context = context;
 }
 public EFCommentRepository(EFDbContext context)
 {
     this.context = context;
 }
 public PartySupporterRepository(EFDbContext context)
 {
     this.context = context;
 }
 public EFPictureRepository(EFDbContext context)
 {
     this.context = context;
 }
Example #17
0
 public VoterRepository(EFDbContext context)
 {
     this.context = context;
 }
 public PrecinctRepository(EFDbContext context)
 {
     this.context = context;
 }
 public AgitatorHouseRelationRepository(EFDbContext context)
 {
     this.context = context;
 }
 public CandidatePrecinctRelationRepository(EFDbContext context)
 {
     this.context = context;
 }
 public AgitatorRepository(EFDbContext context)
 {
     this.context = context;
 }
 public WorkerHouseRelationRepository(EFDbContext context)
 {
     this.context = context;
 }
 public VoterPartyRelationRepository(EFDbContext context)
 {
     this.context = context;
 }
 public TempPersonRepository(EFDbContext context)
 {
     this.context = context;
     //context.Regions.Include(r => r.Organizations);
 }
 public LocalityRepository(EFDbContext context)
 {
     this.context = context;
     //context.Regions.Include(r => r.Organizations);
 }
 public PartyMemberRepository(EFDbContext context)
 {
     this.context = context;
 }
 public EFFriendRequestsRepository(EFDbContext context)
 {
     this.context = context;
 }
 public MunicipalityHouseRelationRepository(EFDbContext context)
 {
     this.context = context;
 }
 public UserLogRepository(EFDbContext context)
 {
     this.context = context;
 }