public async Task <IActionResult> Edit(int id, [Bind("HorseId,HorseName,Location,Notes,Photo")] Horse horse)
        {
            if (id != horse.HorseId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(horse);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HorseExists(horse.HorseId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(horse));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("GrainId,GrainName")] Grain grain)
        {
            if (id != grain.GrainId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(grain);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GrainExists(grain.GrainId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(grain));
        }
        public async Task <IActionResult> Edit(int id, [Bind("HorseGrainId,Amount,AMReport,PMReport,HorseId,GrainId")] HorseGrain horseGrain)
        {
            if (id != horseGrain.HorseGrainId)
            {
                return(NotFound());
            }

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