Exemplo n.º 1
0
        public async Task <ActionResult> Create([Bind(Include = "FeatureId,Title,Description,Icon")] Feature feature)
        {
            if (ModelState.IsValid)
            {
                db.Features.Add(feature);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(feature));
        }
Exemplo n.º 2
0
        public async Task SeedSkills(FeaturesDbContext dbContext)
        {
            var skills = new List <Skills>();

            string[] lines = System.IO.File.ReadAllLines(@"C:\Users\iNexus\Documents\source\repos\HireMe\HireMe\Skills.txt");

            foreach (string line in lines)
            {
                skills = new List <Skills>
                {
                    new Skills
                    {
                        Title = line
                    }
                };
                await dbContext.Skills.AddRangeAsync(skills);
            }

            await dbContext.SaveChangesAsync();
        }
Exemplo n.º 3
0
        public async Task SeedLocation(FeaturesDbContext dbContext)
        {
            var location = new List <Location>();

            string[] lines = System.IO.File.ReadAllLines(@"C:\Users\iNexus\Documents\source\repos\HireMe\HireMe\Location.txt");

            foreach (string line in lines)
            {
                location = new List <Location>
                {
                    new Location
                    {
                        City = line
                    }
                };
                await dbContext.Location.AddRangeAsync(location);
            }

            await dbContext.SaveChangesAsync();
        }
        public async Task SeedCategories(FeaturesDbContext dbContext)
        {
            string[] lines      = File.ReadAllLines(@"C:\Users\iNexus\Documents\source\repos\HireMe\HireMe\Categories.txt");
            var      Categories = new List <Category>();
            var      vals1      = lines;

            for (int i = 0; i <= lines.Length; i++)
            {
                vals1 = lines[i].Split('#');

                Categories = new List <Category>
                {
                    new Category
                    {
                        Title    = vals1[0].ToString(),
                        Title_BG = vals1[1].ToString(),
                        Icon     = vals1[2].ToString()
                    },
                };
                await dbContext.Category.AddRangeAsync(Categories);

                await dbContext.SaveChangesAsync();
            }
        }