public async Task <IActionResult> Edit(int id, [Bind("Id,DateTime,PersonId,BodyWeight,Waist,BodyFat")] PhysicalLog physicalLog) { if (id != physicalLog.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(physicalLog); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PhysicalLogExists(physicalLog.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(ListPhysicalLogs))); } ViewData["PersonId"] = new SelectList(_context.Set <Person>(), "Id", "FullName", physicalLog.PersonId); return(View(physicalLog)); }
public async Task <IActionResult> Edit(int id, [Bind("ImageId,Title,ImageName")] ImageModel imageModel) { if (id != imageModel.ImageId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(imageModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ImageModelExists(imageModel.ImageId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(imageModel)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,DateTime,PersonId,ImageId,LifeLogStatusId,GameId")] LifeLog lifeLog) { if (id != lifeLog.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(lifeLog); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LifeLogExists(lifeLog.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["GameId"] = new SelectList(_context.Set <Game>(), "Id", "GameNumber", lifeLog.GameId); ViewData["PersonId"] = new SelectList(_context.Set <Person>(), "Id", "FullName", lifeLog.PersonId); return(View(lifeLog)); }