Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Group_Name,Coat_Type")] DogGroup dogGroup)
        {
            if (id != dogGroup.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(dogGroup);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DogGroupExists(dogGroup.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(dogGroup));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Activity_Level,Barking_Level")] ActivityLevel activityLevel)
        {
            if (id != activityLevel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(activityLevel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ActivityLevelExists(activityLevel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(activityLevel));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Breed_Name,Age_Years,DogGroupId,ActivityLevelId,SizeId")] Breed breed)
        {
            if (id != breed.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(breed);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BreedExists(breed.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ActivityLevelId"] = new SelectList(_context.ActivityLevel, "Id", "Activity_Level", breed.ActivityLevelId);
            ViewData["DogGroupId"]      = new SelectList(_context.DogGroup, "Id", "Group_Name", breed.DogGroupId);
            ViewData["SizeId"]          = new SelectList(_context.Size, "Id", "Size_Name", breed.SizeId);
            return(View(breed));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Size_Name,Shedding_Name")] Size size)
        {
            if (id != size.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(size);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SizeExists(size.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(size));
        }