Example #1
0
        public void Save(string path)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("Word");
            string[] names = Enum.GetNames(typeof(SportCategory));
            foreach (string name in names)
            {
                builder.Append("," + name);
            }

            foreach (KeyValuePair <string, Dictionary <SportCategory, int> > occurence in _wordOccurenceDatabase)
            {
                builder.Append(Environment.NewLine);
                builder.Append(occurence.Key);
                foreach (string name in names)
                {
                    SportCategory category = (SportCategory)Enum.Parse(typeof(SportCategory), name);
                    if (occurence.Value.ContainsKey(category))
                    {
                        builder.Append("," + occurence.Value[category]);
                    }
                    else
                    {
                        builder.Append(",0");
                    }
                }
            }

            File.WriteAllText(path, builder.ToString());
        }
Example #2
0
        public ActionResult EditFacility(int id, FacilityChangeViewModel model)
        {
            if (this.ModelState.IsValid)
            {
                Facility mappedFacility = AutoMapperConfig.Configuration.CreateMapper().Map <Facility>(model);

                Facility currentFacility = this.facilities.GetFacilityDetails(id);
                foreach (var category in currentFacility.SportCategories)
                {
                    category.Facilities.Remove(currentFacility);
                }

                currentFacility.SportCategories.Clear();

                this.facilities.Save();
                foreach (var categoryId in model.SportCategoriesIds)
                {
                    SportCategory currentCategory = this.sportCategories.GetById(categoryId);
                    mappedFacility.SportCategories.Add(currentCategory);
                }

                this.facilities.UpdateFacility(id, mappedFacility);
                return(this.RedirectToAction("FacilityDetails", "FacilitiesPublic", new { id = id, area = "Facilities" }));
            }

            return(this.View(model));
        }
 public void UpdateSportCategory(int id, SportCategory sportCategory)
 {
     SportCategory sportCategoryToUpdate = this.sportCategories.GetById(id);
     sportCategoryToUpdate.Name = sportCategory.Name;
     sportCategoryToUpdate.Description = sportCategory.Description;
     this.sportCategories.SaveChanges();
 }
Example #4
0
        public async Task <IHttpActionResult> PutSportCategory(Guid id, SportCategory sportCategory)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != sportCategory.CategoryId)
            {
                return(BadRequest());
            }
            using (SportsContext db = new SportsContext())
            {
                db.Entry(sportCategory).State = EntityState.Modified;

                try
                {
                    await db.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (db.SportCategories.Count(e => e.CategoryId == id) <= 0)
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }

                return(StatusCode(HttpStatusCode.NoContent));
            }
        }
Example #5
0
        public void UpdateSportCategory(int id, SportCategory sportCategory)
        {
            SportCategory sportCategoryToUpdate = this.sportCategories.GetById(id);

            sportCategoryToUpdate.Name        = sportCategory.Name;
            sportCategoryToUpdate.Description = sportCategory.Description;
            this.sportCategories.SaveChanges();
        }
        public IQueryable<SportField> GetAllByCategory(SportCategory category)
        {
            var result = this.fields
                .All()
                .Where(x => x.Category == category)
                .OrderByDescending(x => (int)Math.Ceiling((double)x.Ratings.Sum(r => r.Value) / x.Ratings.Count()));

            return result;
        }
Example #7
0
 public ActionResult Edit([Bind(Include = "Id,CategoryName,Active1,Active1x,Active2x,Active12,Active2,ActiveX")] SportCategory sportCategory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sportCategory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(sportCategory));
 }
        public void DeleteSportCategory(int sportCategoryId)
        {
            var sportCategory = new SportCategory {
                Id = sportCategoryId
            };

            _sportCategories.Attach(sportCategory);

            _sportCategories.Remove(sportCategory);
        }
        private void setBorderCategories(SportCategory item)
        {
            var itemTournaments = item.Tournaments;

            foreach (var tournamentItem in itemTournaments)
            {
                tournamentItem.BorderItem = new Thickness(0, 0, 2, 2);
            }
            //TO DO Set border in items
        }
Example #10
0
        public ActionResult Create([Bind(Include = "Id,CategoryName,Active1,Active1x,Active2x,Active12,Active2,ActiveX")] SportCategory sportCategory)
        {
            if (ModelState.IsValid)
            {
                db.sportCategories.Add(sportCategory);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(sportCategory));
        }
        public ActionResult EndorseSkill(string resieverUsername, SportCategory category)
        {
            if (!Request.IsAjaxRequest())
            {
                Response.StatusCode = (int)HttpStatusCode.Forbidden;
                return this.Content("This action can be invoke only by AJAX call");
            }

            this.skillService.Create(category, this.User.Identity.Name, resieverUsername);

            Response.StatusCode = (int)HttpStatusCode.Created;
            return this.Content("OK");
        }
Example #12
0
        public async Task <IHttpActionResult> PostSportCategory(SportCategory sportCategory)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            using (SportsContext db = new SportsContext())
            {
                db.SportCategories.Add(sportCategory);
                await db.SaveChangesAsync();

                return(CreatedAtRoute("DefaultApi", new { id = sportCategory.CategoryId }, sportCategory));
            }
        }
Example #13
0
        public async Task <IHttpActionResult> GetSportCategory(Guid id)
        {
            using (SportsContext db = new SportsContext())
            {
                SportCategory sportCategory = await db.SportCategories.FindAsync(id);

                if (sportCategory == null)
                {
                    return(NotFound());
                }

                return(Ok(sportCategory));
            }
        }
        public async Task <ActionResult> AddSportCategory(AddSportCategoryViewModel sportCategoryModel)
        {
            var sportCategory = new SportCategory
            {
                Name    = sportCategoryModel.SportCategoryName,
                SportId = sportCategoryModel.SportId
            };

            _sportService.AddSportCategory(sportCategory);

            await _dbContext.SaveChangesAsync();

            return(Json(sportCategory.Id, JsonRequestBehavior.AllowGet));
        }
        public void Create(SportCategory category, string creatorUsername, string resieverUsername)
        {
            var creator = this.users.All().Where(x => x.UserName == creatorUsername).FirstOrDefault();
            var resiever = this.users.All().Where(x => x.UserName == resieverUsername).FirstOrDefault();
            var model = new Skill
            {
                Category = category,
                Creator = creator,
                Resiever = resiever
            };

            this.skills.Add(model);
            this.skills.SaveChanges();
        }
Example #16
0
        // GET: SportCategories/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SportCategory sportCategory = db.sportCategories.Find(id);

            if (sportCategory == null)
            {
                return(HttpNotFound());
            }
            return(View(sportCategory));
        }
        public RedirectToActionResult Add(int id)
        {
            var  session   = new SportCountrySession(HttpContext.Session);
            var  countries = session.GetMyCountries();
            bool alreadyin = false;

            SportCountry country = context.SportCountries.Find(id);
            SportGame    game    = context.SportGames.Find(country.GameId);

            country.Game = game;
            SportType     type     = context.SportTypes.Find(country.SportTypeId);
            SportCategory category = context.SportCategories.Find(type.CategoryId);

            type.Category     = category;
            country.SportType = type;

            foreach (var lc in countries)
            {
                if (lc.CountryId == id)
                {
                    alreadyin = true;
                }
            }
            if (alreadyin == false)
            {
                countries.Add(country);
                session.SetMyCountries(countries);


                var cookies = new SportCountryCookies(Response.Cookies);
                cookies.SetMyCountriesIds(countries);



                TempData["message"] = $"{country.Name} added to your favorites";
            }
            else
            {
                TempData["message"] = $"{country.Name} is already in your favorites";
            }

            return(RedirectToAction("sportTest",
                                    new
            {
                activeGame = session.GetActiveGame(),
                activeCategory = session.GetActiveCategory()
            }));
        }
Example #18
0
        public async Task <IHttpActionResult> DeleteSportCategory(Guid id)
        {
            using (SportsContext db = new SportsContext())
            {
                SportCategory sportCategory = await db.SportCategories.FindAsync(id);

                if (sportCategory == null)
                {
                    return(NotFound());
                }

                db.SportCategories.Remove(sportCategory);
                await db.SaveChangesAsync();

                return(Ok(sportCategory));
            }
        }
Example #19
0
        public ViewResult sportFavoriteDetail(int id)
        {
            var session = new SportCountrySession(HttpContext.Session);

            ViewBag.ActiveGame     = session.GetActiveGame();
            ViewBag.ActiveCategory = session.GetActiveCategory();
            SportCountry country = context.SportCountries.Find(id);
            SportGame    game    = context.SportGames.Find(country.GameId);

            country.Game = game;
            SportType     type     = context.SportTypes.Find(country.SportTypeId);
            SportCategory category = context.SportCategories.Find(type.CategoryId);

            type.Category     = category;
            country.SportType = type;
            return(View(country));
        }
Example #20
0
        public void Filter()
        {
            // This could break the test if the pop up si not present
            // Check presence
            if (IsElementPresent(By.Id("closefloatingbox")))
            {
                PopupCloseButton.Click();
            }

            MoviesCategory.Click();
            GamesCategory.Click();
            OthersCategory.Click();
            MusicCategory.Click();
            SoftwareCategory.Click();
            SportCategory.Click();
            RussianFilmsCategory.Click();
        }
Example #21
0
        public ActionResult AddFacility(FacilityChangeViewModel model)
        {
            if (this.ModelState.IsValid)
            {
                Facility mappedFacility = AutoMapperConfig.Configuration.CreateMapper().Map <Facility>(model);
                foreach (var categoryId in model.SportCategoriesIds)
                {
                    SportCategory currentCategory = this.sportCategories.GetById(categoryId);
                    mappedFacility.SportCategories.Add(currentCategory);
                }

                mappedFacility.AuthorId = this.User.Identity.GetUserId();

                this.facilities.Add(mappedFacility);
                return(this.RedirectToAction("FacilityDetails", "FacilitiesPublic", new { id = mappedFacility.Id, area = "Facilities" }));
            }

            return(this.View(model));
        }
Example #22
0
        public double[] GetFeatures(HashSet <string> data)
        {
            Array array = Enum.GetValues(typeof(SportCategory));

            double[] features = new double[array.Length];

            foreach (string s in data)
            {
                if (_wordOccurenceDatabase.ContainsKey(s))
                {
                    Dictionary <SportCategory, int> partial = _wordOccurenceDatabase[s];
                    for (int i = 0; i < array.Length; i++)
                    {
                        SportCategory category = (SportCategory)array.GetValue(i);
                        if (partial.ContainsKey(category))
                        {
                            features[i] += partial[category];
                        }
                    }
                }
            }

            double sum = features.Sum();

            if (Math.Abs(sum) < 0.00001)
            {
                double partial = (double)1 / ((features.Length - 1) * 2);
                features[0] = partial * (features.Length - 1);
                for (int i = 1; i < features.Length; i++)
                {
                    features[i] = partial;
                }
            }
            else
            {
                for (int i = 0; i < features.Length; i++)
                {
                    features[i] /= sum;
                }
            }

            return(features);
        }
Example #23
0
        public void AddWord(string lemma, SportCategory category)
        {
            string key = lemma.ToLowerInvariant();

            if (!_wordOccurenceDatabase.ContainsKey(key))
            {
                _wordOccurenceDatabase.Add(key, new Dictionary <SportCategory, int>());
            }

            Dictionary <SportCategory, int> counts = _wordOccurenceDatabase[key];

            if (counts.ContainsKey(category))
            {
                counts[category]++;
            }
            else
            {
                counts.Add(category, 1);
            }
        }
Example #24
0
        public Marker(NLPProcessor processor, string modelPath)
        {
            _processor = processor;
            _modelPath = modelPath;

            Annotation sportSpecificWords = _processor.Annotate(File.ReadAllText(modelPath + "specificwords.txt"));

            _sportSpecificWords = NLPCoreHelper.GetLemmas(sportSpecificWords);
            File.Delete(modelPath + "specificwords.txt");
            StringBuilder builder = new StringBuilder();

            foreach (string word in _sportSpecificWords)
            {
                builder.AppendLine(word);
            }
            File.WriteAllText(modelPath + "specificwords.txt", builder.ToString());

            PersonOccurenceDatabase             = new WordOccurenceDatabase();
            OrganizationOccurenceDatabase       = new WordOccurenceDatabase();
            LocationsOccurenceDatabase          = new WordOccurenceDatabase();
            SportSpecificWordsOccurenceDatabase = new WordOccurenceDatabase();
            _categoriesCount = Enum.GetValues(typeof(SportCategory)).Length;
            int hiddenLayerCount = (10 * _categoriesCount) / 3;

            _classifier = new ActivationNetwork(new SigmoidFunction(), 4 * _categoriesCount, hiddenLayerCount, _categoriesCount);
            _teacher    = new BackPropagationLearning(_classifier);

            Array values = Enum.GetValues(typeof(SportCategory));

            _categoryIndex = new Dictionary <SportCategory, int>();
            _indexCategory = new Dictionary <int, SportCategory>();
            for (int index = 0; index < values.Length; index++)
            {
                SportCategory category = (SportCategory)values.GetValue(index);
                _categoryIndex.Add(category, index);
                _indexCategory.Add(index, category);
            }
        }
Example #25
0
        public ActionResult SportCategories_Create([DataSourceRequest] DataSourceRequest request, SportCategoryGridViewModel sportCategory)
        {
            var newId = 0;

            if (this.ModelState.IsValid)
            {
                var entity = new SportCategory
                {
                    Name        = sportCategory.Name,
                    Description = sportCategory.Description
                };

                this.sportCategories.Add(entity);
                this.sportCategories.Save();
                newId = entity.Id;
            }

            var postToDisplay =
                this.sportCategories.All()
                .To <SportCategoryGridViewModel>()
                .FirstOrDefault(x => x.Id == newId);

            return(this.Json(new[] { sportCategory }.ToDataSourceResult(request, ModelState)));
        }
 public void AddSportCategory(SportCategory sportCategory)
 {
     _sportCategories.Add(sportCategory);
 }
        private void FillTournaments()
        {
            Tournaments.Clear();
            if (flag1)
            {
                lock (_itemsLock)
                {
                    flag1 = false;
                    SortableObservableCollection <IMatchVw> matches = new SortableObservableCollection <IMatchVw>();
                    int tournamentsAmount = ChangeTracker.IsLandscapeMode ? 10 : 8;
                    SyncObservableCollection <SportCategory> tempCategories = new SyncObservableCollection <SportCategory>();

                    matches = Repository.FindMatches(matches, "", SelectedLanguage, MatchFilter, Sort);

                    //lets see if we can start from categories, not tournaments
                    var groups = matches.Where(x => !x.IsOutright && x.CategoryView != null).Select(x => x.CategoryView).Distinct().ToList();

                    foreach (var group in groups)
                    {
                        SportCategory temp = new SportCategory(group.DisplayName, new SyncObservableCollection <TournamentVw>(), group.LineObject.GroupId);
                        temp.Sort = group.LineObject.Sort.Value;
                        tempCategories.Add(temp);
                    }
                    tempCategories = new SyncObservableCollection <SportCategory>(tempCategories.OrderBy(x => x.Sort).ToList());

                    foreach (SportCategory category in tempCategories)
                    {
                        //fill tournaments - not outrights

                        List <TournamentVw> Tournaments = new List <TournamentVw>();
                        var tours = matches.Where(x => !x.IsOutright && x.TournamentView != null && x.CategoryView != null && x.CategoryView.LineObject.GroupId == category.CategoryID).Select(x => x.TournamentView).Distinct().ToList();
                        int allTournamentsCount = tours.Count;

                        for (int i = 0; i < tours.Count; i++)
                        {
                            long   id             = tours[i].LineObject.GroupId;
                            long   svrId          = tours[i].LineObject.SvrGroupId;
                            string tournamentName = tours[i].DisplayName;
                            long   countryId      = 0;
                            string country        = "";

                            int    sort           = tours[i].LineObject.Sort.Value;
                            string minCombination = null;

                            if (tours[i].LineObject.GroupTournament != null && tours[i].LineObject.GroupTournament.MinCombination.Value > 0)
                            {
                                minCombination = TranslationProvider.Translate(MultistringTags.TERMINAL_X_COMB, tours[i].LineObject.GroupTournament.MinCombination.Value);
                            }

                            if (tours[i].TournamentCountryView != null)
                            {
                                countryId = tours[i].TournamentCountryView.LineObject.SvrGroupId;
                                country   = tours[i].TournamentCountryView.DisplayName;
                            }

                            long   sportId   = 0;
                            string sportName = "";

                            if (tours[i].TournamentSportView != null)
                            {
                                sportId   = tours[i].TournamentSportView.LineObject.SvrGroupId;
                                sportName = tours[i].TournamentSportView.DisplayName;
                            }

                            bool isOutright = false;
                            long categoryId = 0;

                            TournamentVw tour = new TournamentVw(id, svrId, tournamentName, countryId, sort, minCombination, country, sportId, isOutright, sportName, categoryId);
                            tour.TemporaryMatchesCount = matches.Where(x => !x.IsOutright && x.TournamentView != null && x.TournamentView.LineObject.GroupId == tour.Id).Count();
                            tour.ApplayTemporaryMatchesCount();

                            if (ChangeTracker.SelectedTournaments.Contains(tour.Id.ToString() + "*0"))
                            {
                                tour.IsSelected = true;
                            }

                            Tournaments.Add(tour);
                        }

                        Tournaments = new List <TournamentVw>(Tournaments.OrderBy(x => x.Sort));
                        Tournaments.Sort(Comparison);
                        //now i have all category tournaments

                        for (int i = 0; i < tournamentsAmount; i++)
                        {
                            if (i >= Tournaments.Count)
                            {
                                break;
                            }

                            category.Tournaments.Add(Tournaments[i]);
                        }

                        Tournaments.Clear();
                        //if there is only outrights, add them to category
                        int outrightCount = matches.Where(x => x.IsOutright && x.CategoryView != null && x.CategoryView.LineObject.GroupId == category.CategoryID).Count();
                        if (outrightCount > 0)
                        {
                            allTournamentsCount++;
                        }

                        if (category.Tournaments.Count == 0 || category.Tournaments.Count < tournamentsAmount)
                        {
                            if (outrightCount > 0)
                            {
                                TournamentVw outright = new TournamentVw(int.MinValue, 0, TranslationProvider.Translate(MultistringTags.OUTRIGHTS).ToString(), 0, int.MinValue, null, "", category.CategoryID, true, category.SportName);
                                outright.MatchesCount = outrightCount;
                                category.Tournaments.Add(outright);
                            }
                        }

                        //add all tournaments button
                        if (allTournamentsCount > category.Tournaments.Count)
                        {
                            category.Tournaments.RemoveAt(category.Tournaments.Count - 1);

                            TournamentVw allTournaments = new TournamentVw(int.MinValue, -999, "All tournaments", 0, int.MinValue, null, "", category.CategoryID, true, category.SportName);
                            allTournaments.MatchesCount = allTournamentsCount;
                            category.Tournaments.Add(allTournaments);
                        }
                    }


                    SetImageCategories(tempCategories);
                    Dispatcher.BeginInvoke((Action)(() =>
                    {
                        Categories.ApplyChanges(tempCategories);
                    }));
                }
            }
        }
Example #28
0
 public LabeledArticle(string article, SportCategory category)
 {
     Article     = article;
     Category    = category;
     IsProcessed = false;
 }
Example #29
0
 public void Add(SportCategory sportCategory)
 {
     this.sportCategories.Add(sportCategory);
     this.sportCategories.SaveChanges();
 }
 public SportBall(int nbr, SportCategory tp, string name)
 {
     players = nbr;
     _type   = tp;
     sport   = name;
 }
Example #31
0
        public SportCategory GetById(int sportCategoryId)
        {
            SportCategory foundSportCategory = this.sportCategories.GetById(sportCategoryId);

            return(foundSportCategory);
        }
Example #32
0
 public void Remove(SportCategory sportCategory)
 {
     this.sportCategories.Delete(sportCategory.Id);
 }
Example #33
0
        protected override void Seed(SportsBookDbContext context)
        {
            // this.userManager = new UserManager<AppUser>(new UserStore<AppUser>(context));
            var userManager = new UserManager <AppUser>(new UserStore <AppUser>(context));
            var roleManager = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(context));

            if (!roleManager.Roles.Any())
            {
                roleManager.Create(new IdentityRole {
                    Name = "User"
                });
                roleManager.Create(new IdentityRole {
                    Name = "Admin"
                });
            }

            var adminUser = userManager.Users.FirstOrDefault(x => x.Email == "*****@*****.**");

            if (adminUser == null)
            {
                var admin = new AppUser
                {
                    Email          = "*****@*****.**",
                    UserName       = "******",
                    EmailConfirmed = true,
                    Avatar         = "http://www.premiumdxb.com/assets/img/avatar/default-avatar.jpg",
                    FirstName      = "admin",
                    LastName       = "admin"
                };

                userManager.Create(admin, "123456");
                userManager.AddToRole(admin.Id, "Admin");
            }

            if (userManager.Users.FirstOrDefault(x => x.Email == "*****@*****.**") == null)
            {
                var user = new AppUser
                {
                    Email     = "*****@*****.**",
                    UserName  = "******",
                    Avatar    = "http://www.premiumdxb.com/assets/img/avatar/default-avatar.jpg",
                    FirstName = "user1",
                    LastName  = "user1"
                };

                userManager.Create(user, "123456");
                userManager.AddToRole(user.Id, "User");
            }

            if (userManager.Users.FirstOrDefault(x => x.Email == "*****@*****.**") == null)
            {
                var user = new AppUser
                {
                    Email     = "*****@*****.**",
                    UserName  = "******",
                    Avatar    = "http://www.premiumdxb.com/assets/img/avatar/default-avatar.jpg",
                    FirstName = "user2",
                    LastName  = "user2"
                };

                userManager.Create(user, "123456");
                userManager.AddToRole(user.Id, "User");
            }

            if (userManager.Users.FirstOrDefault(x => x.Email == "*****@*****.**") == null)
            {
                var user = new AppUser
                {
                    Email     = "*****@*****.**",
                    UserName  = "******",
                    Avatar    = "http://www.premiumdxb.com/assets/img/avatar/default-avatar.jpg",
                    FirstName = "user3",
                    LastName  = "user3"
                };

                userManager.Create(user, "123456");
                userManager.AddToRoles(user.Id, "User", "Admin");
            }

            if (userManager.Users.FirstOrDefault(x => x.Email == "*****@*****.**") == null)
            {
                var user = new AppUser
                {
                    Email     = "*****@*****.**",
                    UserName  = "******",
                    Avatar    = "http://www.premiumdxb.com/assets/img/avatar/default-avatar.jpg",
                    FirstName = "user4",
                    LastName  = "user4"
                };

                userManager.Create(user, "123456");
                userManager.AddToRole(user.Id, "User");
            }

            adminUser = userManager.Users.FirstOrDefault(x => x.Email == "*****@*****.**");

            if (adminUser != null)
            {
                userManager.AddToRoles(adminUser.Id, "User", "Admin");
            }

            var allUsers = context.Users.AsQueryable();

            context.SaveChanges();

            if (context.Cities.Count() == 0)
            {
                City sofia = new City
                {
                    Name = "Sofia"
                };

                City plovdiv = new City
                {
                    Name = "Plovdiv"
                };

                context.Cities.Add(sofia);
                context.Cities.Add(plovdiv);

                context.SaveChanges();
            }

            if (context.Facilities.Count() == 0)
            {
                var      userOwner    = userManager.Users.FirstOrDefault(x => x.Email == "*****@*****.**");
                City     sofia        = context.Cities.FirstOrDefault(x => x.Name == "Sofia");
                Facility sportnaSofia = new Facility
                {
                    Name        = "Спортна София - Борисова",
                    City        = sofia,
                    Image       = "http://www.sportnasofia2000.com/sites/default/files/brilliant_gallery_temp/bg_cached_resized_0a9e63899daf685189624faea3f31d88.jpg",
                    Description = "Един модерен, многофункционален спортен комплекс, изграден в паркова среда," +
                                  "съобразно съвременните тенденции и изисквания за спорт и възстановяване на всички слоеве от населението." +
                                  "С възможности за индивидуални или организирани занимания със спорт – Комплексът се превърна в любимо място за деца," +
                                  "ученици, студенти и възрастни. Разположен в пространството между националния стадион “Васил Левски” и стадион" +
                                  "“Българска армия” в близост до БНР на площ от 8 000 кв.м.комплексът разполага с четири игрища за футбол / малки," +
                                  "средни и големи врати / -покрити с изкуствена тревна настилка, игрище за тенис на корт,игрище за популярната" +
                                  "френска игра “Петанк”, площадка за тенис на маса / 5 тенис маси /. Две външни съблекални, две закрити съблекални," +
                                  "250 седящи места, осветление на всяко игрище, паркинг с 30 места и стоянка за велосипеди, кафе – клуб за отдих" +
                                  "и възстановяване - допълват удоволствието за спорт и почивка на посетителите.",
                    AuthorId  = userOwner.Id,
                    CreatedOn = DateTime.UtcNow
                };

                context.Facilities.Add(sportnaSofia);

                Facility silverCity = new Facility
                {
                    Name        = "Silver City",
                    City        = sofia,
                    Image       = "http://silvercitysport.bg/wp-content/uploads/2015/03/basein223.jpg",
                    Description = "Няма нищо по - ефективно и полезно от плуването.То развива всички мускулни групи," +
                                  "без да натоварва ставите.Тонизира кожата и увеличава дихателния капацитет на белите дробове.Масажиращият" +
                                  "ефект на водата помага при борбата с целулита.Подходящ спорт за всяка възраст. Комплексът разполага с басейн" +
                                  "с четири  коридора с дълбочина 1.30 – 1.70м.и размери 17×10м. Треньорите ни се занимават както с начинаещи," +
                                  "така и с плувци ориентирани професионално към спорта. Всеки вторник басейнът е в профилактика от 7:00 до 9:30 часа.",
                    AuthorId  = userOwner.Id,
                    CreatedOn = DateTime.UtcNow
                };

                context.Facilities.Add(silverCity);

                Facility dema = new Facility
                {
                    Name        = "Дема",
                    City        = sofia,
                    Image       = "http://demasport.com/wp-content/uploads/2014/04/s-t-2_0_0.png",
                    Description = "ТЕНИС КЛУБ „ДЕМА“ Е НА 2 - РО МЯСТО МЕЖДУ 136 КЛУБА В СТРАНАТА" +
                                  "Базата предлага: 7 червени корта, от които 3 с осветление, балон върху 3 корта през зимата," +
                                  "система за автоматично поливане, телевизионна площадка, трибуни с 400 седящи места",
                    AuthorId  = userOwner.Id,
                    CreatedOn = DateTime.UtcNow
                };

                context.Facilities.Add(dema);

                Facility kristal = new Facility
                {
                    Name        = "Кристал",
                    City        = sofia,
                    Image       = "https://imgrabo.com/pics/guide/900x600/20150512141847_28449.jpg",
                    Description = "Спортен комплекс КРИСТАЛ е многофункционална сграда," +
                                  "в която Ви предлагаме спортни занимания, разнообразние от СПА, козметични и масажни процедури," +
                                  "богата гама от спортни курсове като: аеробика, тай - бо, народни танци и др." +
                                  "Комплексът разполага с фитнес зала TECHNOGYM 700 кв.м., басейн, боксова зала с квалифизирани инструктори," +
                                  "четири съблекални със стаи за релакс, SPA център(сауна, парна баня, инфрачервена кабина, свето и цвето терапия)" +
                                  "масажни и козметични процедури, солариум (хоризонтален, вертикален).Също така, може да ползвате и паркинг," +
                                  "бензиностанция, автомивка, ресторант и коктейл - бар. Прредлагаме курсове по:" +
                                  "цялостна кондиция на тялото, степ аеробика, йога, народни танци, модерни танци, модерни танци за деца" +
                                  "кик - бокс и др. Масажи: класически, частични, спортни, антицелулитни, лечебни, аромотерапии и др.",
                    AuthorId  = userOwner.Id,
                    CreatedOn = DateTime.UtcNow
                };

                context.Facilities.Add(kristal);

                Facility sportnaPalata = new Facility
                {
                    Name        = "Спортна Палата",
                    City        = sofia,
                    Image       = "http://sportuvai.bg/pictures/470654_401_301.jpg",
                    Description = "Спортна палата към Министерство на физическото възпитание и спорта се намира на бул. Васил Левски." +
                                  "Комплексът разполага с 25 м закрит басейн, фитнес зала.Провеждат се курсове по аеробика от професионални инструктори." +
                                  "Спортният център предлага антицелулитни масажи и сауна.",
                    AuthorId  = userOwner.Id,
                    CreatedOn = DateTime.UtcNow
                };

                context.Facilities.Add(sportnaPalata);

                Facility baroco = new Facility
                {
                    Name        = "Бароко спорт",
                    City        = sofia,
                    Image       = "http://baroccosport.com/images/phocagallery/thumbs/phoca_thumb_l_imgp1530.jpg",
                    Description = "Настилката е изкуствена трева с дължина 5 см и пълнеж от гумени гранули.Fibrillated fibre - е тревно влакно - като преждата," +
                                  "но изрязани по специална технология, което означава, че се правят малки разрези в самото влакно на тревата," +
                                  "като се получава типичната структура на медена пита.Fibrillated тревите поради специфичната структура на влакната притежават по - добро запълване на каучуковите гранули," +
                                  "по - трудно гранулите излизат от тревата по време на игра.Тревата е поставена върху каменна основа," +
                                  "което осигурява добър дренаж на терена и по - голямата му мекота при игра.Игрището е оградено със 6 м.ограда," +
                                  "като е покрито с мрежа и отгоре.Обурудвано е с 8 бр.осветителни тела," +
                                  "които осугуряват необходимата светлина за игра," +
                                  "в късните часове на денонощието.Вратите са стандартни за мини футбол 3 на 2 м.",
                    AuthorId  = userOwner.Id,
                    CreatedOn = DateTime.UtcNow
                };

                context.Facilities.Add(baroco);

                Facility academika = new Facility
                {
                    Name        = "Академика",
                    City        = sofia,
                    Image       = "http://academica2011.com/images/stories/skakademika4km/novstadion.jpg",
                    Description = "Спортен комплекс Академика се намира на бул.Цариградско шосе № 125. Обекта е с изключително" +
                                  "добро инфраструктурно разположение, отлична транспортна достъпност до линиите на градския транспорт и има" +
                                  "осигурен паркинг. Комплексът разполага с три спортни зали, плувен басейн и футболно игрище." +
                                  "Основната зала има мултифункционален характер и може да се използва за тренировки по множество спортове като баскетбол," +
                                  "волейбол, бадмигтон, футзал и др.Зала А е с по - малки размери, но също предлага отлични условия за практикуване" +
                                  "на спортове като волейбол, баскетбол, бойни изкуства, а така също е снабдена с огледала, което я прави удобна" +
                                  "за тренировки по танци, аеробика, каланетика, и други.Зала Б е подходяща за бокс, кикбокс и други бойни изкуства." +
                                  "Спортният комплекс разполага с 25 метров плувен басейн, с пет коридора.В него се поддържа високо ниво" +
                                  "на санитарно - хигиенните условия.Обекта предоставя отлични условия за практикуване на различни плувни спортове." +
                                  "Футболното игрище в комплекса е подходящо както за провеждане на редовни тренировки по футбтол, така и за състезания" +
                                  "и първенства.Игрището е осветено, което позволява да се провеждат тренировки и в по - късните часове.",
                    AuthorId  = userOwner.Id,
                    CreatedOn = DateTime.UtcNow
                };

                context.Facilities.Add(academika);

                context.SaveChanges();
            }

            var facilities = context.Facilities.Take(10).ToList();

            if (context.SportCategories.Count() == 0)
            {
                SportCategory football = new SportCategory
                {
                    Name        = "Football",
                    Description = "Description"
                };

                SportCategory fitness = new SportCategory
                {
                    Name        = "Fitness",
                    Description = "Description"
                };

                SportCategory swimming = new SportCategory
                {
                    Name        = "Swimming",
                    Description = "Description"
                };

                SportCategory tenis = new SportCategory
                {
                    Name        = "Tenis",
                    Description = "Description"
                };

                SportCategory volleyball = new SportCategory
                {
                    Name        = "Volleyball",
                    Description = "Description"
                };

                SportCategory basketball = new SportCategory
                {
                    Name        = "Basketball",
                    Description = "Description"
                };

                football.Facilities.Add(facilities[0]);
                swimming.Facilities.Add(facilities[1]);
                fitness.Facilities.Add(facilities[1]);
                tenis.Facilities.Add(facilities[2]);
                swimming.Facilities.Add(facilities[3]);
                swimming.Facilities.Add(facilities[4]);
                football.Facilities.Add(facilities[5]);
                volleyball.Facilities.Add(facilities[6]);
                football.Facilities.Add(facilities[6]);
                basketball.Facilities.Add(facilities[6]);

                context.SportCategories.Add(football);
                context.SportCategories.Add(volleyball);
                context.SportCategories.Add(basketball);
                context.SportCategories.Add(fitness);
                context.SportCategories.Add(swimming);
                context.SportCategories.Add(tenis);

                context.SaveChanges();
            }
        }
 public void Remove(SportCategory sportCategory)
 {
     this.sportCategories.Delete(sportCategory.Id);
 }
Example #35
0
        public ActionResult SportCategories_Destroy([DataSourceRequest] DataSourceRequest request, SportCategory sportCategory)
        {
            this.sportCategories.Remove(sportCategory);
            this.sportCategories.Save();

            return(this.Json(new[] { sportCategory }.ToDataSourceResult(request, ModelState)));
        }
 public void Add(SportCategory sportCategory)
 {
     this.sportCategories.Add(sportCategory);
     this.sportCategories.SaveChanges();
 }