Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Overall,Apartment,NoviceOwners,Sensitivity,Alone,ColdWeather,HotWeather")] Adaptibility adaptibility)
        {
            if (id != adaptibility.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(adaptibility);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AdaptibilityExists(adaptibility.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(adaptibility));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("ID,Overall,Apartment,NoviceOwners,Sensitivity,Alone,ColdWeather,HotWeather")] Adaptibility adaptibility)
        {
            if (ModelState.IsValid)
            {
                _context.Add(adaptibility);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(adaptibility));
        }