<commit_before>﻿namespace PartyMate.Data.Migrations
{
    using System.Data.Entity.Migrations;
    using System.Linq;

    using Microsoft.AspNet.Identity;
    using Microsoft.AspNet.Identity.EntityFramework;

    using Models;

    using Common;
    using PartyMate.Common;

    public sealed class Configuration : DbMigrationsConfiguration<ApplicationDbContext>
    {
        public Configuration()
        {
            this.AutomaticMigrationsEnabled = true;
            this.AutomaticMigrationDataLossAllowed = true;
        }

        protected override void Seed(ApplicationDbContext context)
        {
            if (!context.Roles.Any())
            {
                var roleStore = new RoleStore<IdentityRole>(context);
                var roleManager = new RoleManager<IdentityRole>(roleStore);

                // Create Admin role
                var adminRole = new IdentityRole { Name = GlobalConstants.AdministratorRoleName };
                roleManager.Create(adminRole);

                // Create User role
                var userRole = new IdentityRole { Name = GlobalConstants.UserRoleName };
                roleManager.Create(userRole);

                // Create admin user
                var userStore = new UserStore<User>(context);
                var userManager = new UserManager<User>(userStore);
                var admin = new User
                {
                    FirstName = GlobalConstants.AdministratorFirstName,
                    LastName = GlobalConstants.AdministratorLastName,
                    UserName = GlobalConstants.AdministratorUserName,
                    Email = GlobalConstants.AdministratorUserName
                };

                userManager.Create(admin, GlobalConstants.AdministratorPassword);

                // Assign user to admin role
                userManager.AddToRole(admin.Id, GlobalConstants.AdministratorRoleName);

                // Add TelerikAcademy for Demo Purposes
                var location = new Location()
                {
                    Longitude = 23.3772423,
                    Latitude = 42.6508509
                };

                var locations = new DeletableEntityRepository<Location>(context);
                locations.Add(location);
                locations.SaveChanges();

                var club = new Club()
                {
                    ProfilePicUrl = "http://telerikacademy.com/Content/Images/news-img01.png",
                    Name = "TelerikAcademy",
                    Adress = @"бул. ""Александър Малинов"" 31, 1729 София",
                    Phone = "02 809 9897",
                    Location = location,
                    SiteUrl = "http://academy.telerik.com/",
                    FacebookUrl = "https://www.facebook.com/TelerikAcademy",
                    TwitterUrl = "https://twitter.com/TelerikAcademy",
                    Email = "",
                    Capacity = 2000,
                    ModeratorId = admin.Id
                };

                var review = new ClubReview()
                {
                    Club = club,
                    Content = "TEST TEST TEST TEST",
                    Rating = 5,
                    Author = admin
                };

                var reviews = new DeletableEntityRepository<ClubReview>(context);
                reviews.Add(review);
                var clubs = new DeletableEntityRepository<Club>(context);
                clubs.Add(club);

                var club2 = new Club()
                {
                    ProfilePicUrl = "http://yaltaclub.com/images/yalta-logo.png?1383083648",
                    Name = "<NAME>",
                    Adress = @"20, <NAME>itel Blvd, Sofia 1000, Bulgaria",
                    Phone = "0897 870 230",
                    Location = location,
                    SiteUrl = "http://yaltaclub.com/",
                    FacebookUrl = "https://www.facebook.com/yaltaclub",
                    TwitterUrl = "",
                    Email = "",
                    Capacity = 4000,<commit_msg>seeding more data<commit_after>﻿namespace PartyMate.Data.Migrations
{
    using System.Data.Entity.Migrations;
    using System.Linq;

    using Microsoft.AspNet.Identity;
    using Microsoft.AspNet.Identity.EntityFramework;

    using Models;

    using Common;
    using PartyMate.Common;

    public sealed class Configuration : DbMigrationsConfiguration<ApplicationDbContext>
    {
        public Configuration()
        {
            this.AutomaticMigrationsEnabled = true;
            this.AutomaticMigrationDataLossAllowed = true;
        }

        protected override void Seed(ApplicationDbContext context)
        {
            if (!context.Roles.Any())
            {
                var roleStore = new RoleStore<IdentityRole>(context);
                var roleManager = new RoleManager<IdentityRole>(roleStore);

                // Create Admin role
                var adminRole = new IdentityRole { Name = GlobalConstants.AdministratorRoleName };
                roleManager.Create(adminRole);

                // Create User role
                var userRole = new IdentityRole { Name = GlobalConstants.UserRoleName };
                roleManager.Create(userRole);

                // Create admin user
                var userStore = new UserStore<User>(context);
                var userManager = new UserManager<User>(userStore);
                var admin = new User
                {
                    FirstName = GlobalConstants.AdministratorFirstName,
                    LastName = GlobalConstants.AdministratorLastName,
                    UserName = GlobalConstants.AdministratorUserName,
                    Email = GlobalConstants.AdministratorUserName
                };

                userManager.Create(admin, GlobalConstants.AdministratorPassword);

                // Assign user to admin role
                userManager.AddToRole(admin.Id, GlobalConstants.AdministratorRoleName);

                // Add TelerikAcademy for Demo Purposes
                var location = new Location()
                {
                    Longitude = 23.3772423,
                    Latitude = 42.6508509
                };

                var locations = new DeletableEntityRepository<Location>(context);
                locations.Add(location);
                locations.SaveChanges();

                var club = new Club()
                {
                    ProfilePicUrl = "http://telerikacademy.com/Content/Images/news-img01.png",
                    Name = "TelerikAcademy",
                    Adress = @"бул. ""<NAME>"" 31, 1729 София",
                    Phone = "02 809 9897",
                    Location = location,
                    SiteUrl = "http://academy.telerik.com/",
                    FacebookUrl = "https://www.facebook.com/TelerikAcademy",
                    TwitterUrl = "https://twitter.com/TelerikAcademy",
                    Email = "<EMAIL>",
                    Capacity = 2000,
                    ModeratorId = admin.Id
                };

                var review = new ClubReview()
                {
                    Club = club,
                    Content = "TEST TEST TEST TEST",
                    Rating = 5,
                    Author = admin
                };

                var reviews = new DeletableEntityRepository<ClubReview>(context);
                reviews.Add(review);
                var clubs = new DeletableEntityRepository<Club>(context);
                clubs.Add(club);

                var club2 = new Club()
                {
                    ProfilePicUrl = "http://yaltaclub.com/images/yalta-logo.png?1383083648",
                    Name = "<NAME>",
                    Adress = @"20, Tsar Osvoboditel Blvd, Sofia 1000, Bulgaria",
                    Phone = "0897 870 230",
                    Location = location,
                    SiteUrl = "http://yaltaclub.com/",
                    FacebookUrl = "https://www.facebook.com/yaltaclub",
                    TwitterUrl = "",
                    Email = "<EMAIL>",
                    Capacity = 4000,
{'fraction_non_alphanumeric': 0.08343618859540854, 'fraction_numerical': 0.017526536657615402, 'mean_word_length': 1.3867452135493372, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 6, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3829818', 'n_tokens_mistral': 2120, 'n_tokens_neox': 1825, 'n_words': 401}