Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("Id,Name,Info")] Breed breed)
        {
            if (ModelState.IsValid)
            {
                _context.Add(breed);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(breed));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Adress,CityId,Capacity")] Cattery cattery)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cattery);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CityId"] = new SelectList(_context.City, "Id", "Name", cattery.CityId);
            return(View(cattery));
        }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("Id,Name,YearOfBirth,Gender,BreedId,CatteryId")] Cat cat)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cat);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BreedId"]   = new SelectList(_context.Breed, "Id", "Name", cat.BreedId);
            ViewData["CatteryId"] = new SelectList(_context.Cattery, "Id", "Name", cat.CatteryId);
            return(View(cat));
        }
        public async Task <IActionResult> Create([Bind("Id,CatId,TemperId")] CatTemper catTemper)
        {
            if (ModelState.IsValid)
            {
                _context.Add(catTemper);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CatId"]    = new SelectList(_context.Cat, "Id", "Name", catTemper.CatId);
            ViewData["TemperId"] = new SelectList(_context.Temper, "Id", "Name", catTemper.TemperId);
            return(View(catTemper));
        }