public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Adress,CityId,Capacity")] Cattery cattery) { if (id != cattery.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(cattery); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CatteryExists(cattery.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CityId"] = new SelectList(_context.City, "Id", "Name", cattery.CityId); return(View(cattery)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,YearOfBirth,Gender,BreedId,CatteryId")] Cat cat) { if (id != cat.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(cat); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CatExists(cat.Id)) { return(NotFound()); } else { throw; } } 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> Edit(int id, [Bind("Id,Name,Info")] 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))); } return(View(breed)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,CatId,TemperId")] CatTemper catTemper) { if (id != catTemper.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(catTemper); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CatTemperExists(catTemper.Id)) { return(NotFound()); } else { throw; } } 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)); }