Esempio n. 1
0
        public async Task <IActionResult> PutDealership(int id, Dealership dealership)
        {
            if (id != dealership.Id)
            {
                return(BadRequest());
            }

            _context.Entry(dealership).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DealershipExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("Id,Make,Model,Year,VIN,Color,DealershipID")] Car car)
        {
            if (ModelState.IsValid)
            {
                _context.Add(car);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(car));
        }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Email,Company,Position,BirthDate")] Member member)
        {
            if (ModelState.IsValid)
            {
                _context.Add(member);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(member));
        }
Esempio n. 4
0
        public async Task <IActionResult> Create([Bind("Id,HikeName,Path")] Hike hike)
        {
            if (ModelState.IsValid)
            {
                _context.Add(hike);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Path"] = new SelectList(_context.Paths, "Id", "Id", hike.Path);
            return(View(hike));
        }
Esempio n. 5
0
        public async Task <IActionResult> Create(int hike, [Bind("TrueId,Name,Side,Id,MaxHealth,NowHealth,MaxEnergy,NowEnergy,MaxSatiety,NowSatiety,MaxSanity,NowSanity,Status,Strength,HeavyWeapone,ResourceGather,Carrying,HandToHand,Bruteforce,Dexterity,LightWeapone,RangedWeapone,Sneak,Dodge,Agility,Constitution,Shield,Armour,Stamina,Health,Balance,Intelligence,MagickPower,Medicine,Cooking,Science,Craft,Memory,Willpower,MagickLevel,Languages,Learning,Logistics,Perception,Hunting,Traps,Foraging,Spotting,Pathfinding,Charisma,Persuation,Intimidation,Trade,Music,Discussion,Leadership,Command,Tactic,Strategy,Survival,Adjutant,Epathy,Lie,LieDetector,Psycology,Pacification,AnimalHandling,Weapone,Hike,BattleTactic")] Character character)
        {
            character.Hike         = hike;
            character.BattleTactic = 0;
            character.Weapone      = 0;
            if (ModelState.IsValid)
            {
                _context.Add(character);
                await _context.SaveChangesAsync();

                //return RedirectToAction(nameof(Index));
                return(RedirectToAction("Index", "Characters", new { id = hike, name = _context.Hikes.Where(c => c.Id == hike).FirstOrDefault().HikeName }));
            }
            //ViewData["BattleTactic"] = new SelectList(_context.Tactics, "Id", "Id", character.BattleTactic);
            //ViewData["Hike"] = new SelectList(_context.Hikes, "Id", "Id", character.Hike);
            //ViewData["Weapone"] = new SelectList(_context.Items, "Id", "Id", character.Weapone);
            //return View(character);
            return(RedirectToAction("Index", "Characters", new { id = hike, name = _context.Hikes.Where(c => c.Id == hike).FirstOrDefault().HikeName }));
        }
Esempio n. 6
0
        public async Task <string> Seed()
        {
            int numberOfDealerships = 0;

            if (_context.Dealership.Count() == 0)
            {
                Dealership dealership1 = new Dealership {
                    Name = "dealership1", Email = "*****@*****.**"
                };
                Dealership dealership2 = new Dealership {
                    Name = "dealership2", Email = "*****@*****.**"
                };
                Dealership dealership3 = new Dealership {
                    Name = "dealership3", Email = "*****@*****.**"
                };

                _context.AddRange(dealership1, dealership2, dealership3);
                await _context.SaveChangesAsync();

                numberOfDealerships = 3;
            }

            return($"{numberOfDealerships} Dealerships Added");
        }