Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("IdProduct,Tails")] Foxes foxes)
        {
            if (id != foxes.IdProduct)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(foxes);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FoxesExists(foxes.IdProduct))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdProduct"] = new SelectList(_context.Product, "Id", "Id", foxes.IdProduct);
            return(View(foxes));
        }
Esempio n. 2
0
 public void FoxCheckerAdder(string Name)
 {
     if (!Foxes.Exists(f => f.Name.Contains(Name)))
     {
         Foxes.Add(new Fox(Name));
         FoxIndex = Foxes.Count() - 1;
     }
     else
     {
         FoxIndex = Foxes.FindIndex(f => f.Name.Contains(Name));
     }
 }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("IdProduct,Tails")] Foxes foxes)
        {
            if (ModelState.IsValid)
            {
                _context.Add(foxes);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdProduct"] = new SelectList(_context.Product, "Id", "Id", foxes.IdProduct);
            return(View(foxes));
        }
Esempio n. 4
0
        public Fox GetCurrentFox(string name)
        {
            var CurrentFox = Foxes.FirstOrDefault(i => i.FoxName == name);

            return(CurrentFox);
        }
Esempio n. 5
0
 public void AddFox(Fox fox)
 {
     Foxes.Add(fox);
 }
Esempio n. 6
0
 public Fox FindByName(string name)
 {
     return(Foxes.Find(p => p.Name.Equals(name)));
 }
Esempio n. 7
0
 public HomeController(Foxes foxes)
 {
     this.foxes = foxes;
 }