Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,RegistrationNumber,TrapTypeId,TrapUserId")] Trap trap)
        {
            if (id != trap.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(trap);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TrapExists(trap.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TrapTypeId"] = new SelectList(_context.TrapType, "Id", "Id", trap.TrapTypeId);
            ViewData["TrapUserId"] = new SelectList(_context.TrapUser, "Id", "Id", trap.TrapUserId);
            return(View(trap));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description")] TrapType trapType)
        {
            if (id != trapType.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(trapType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TrapTypeExists(trapType.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(trapType));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,City,StreetName,StreetNumber")] Landowner landowner)
        {
            if (id != landowner.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(landowner);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LandownerExists(landowner.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(landowner));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Password")] Manager manager)
        {
            if (id != manager.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(manager);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ManagerExists(manager.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(manager));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description,Image")] Animal animal)
        {
            if (id != animal.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(animal);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AnimalExists(animal.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(animal));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,date,TrapId,AnimalId,ManagerId")] TrapCatchEvent trapCatchEvent)
        {
            if (id != trapCatchEvent.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(trapCatchEvent);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TrapCatchEventExists(trapCatchEvent.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AnimalId"]  = new SelectList(_context.Animal, "Id", "Name", trapCatchEvent.AnimalId);
            ViewData["ManagerId"] = new SelectList(_context.Manager, "Id", "Name", trapCatchEvent.ManagerId);
            ViewData["TrapId"]    = new SelectList(_context.Trap, "Id", "Name", trapCatchEvent.TrapId);
            return(View(trapCatchEvent));
        }
Exemplo n.º 7
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,DateRegistered,LandownerId")] TrapUser trapUser)
        {
            if (id != trapUser.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(trapUser);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TrapUserExists(trapUser.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LandownerId"] = new SelectList(_context.Landowner, "Id", "Id", trapUser.LandownerId);
            return(View(trapUser));
        }