public async Task <IActionResult> Edit(int id, [Bind("CageLogId,AnimalID,Clean,Food,FoodComments,Social,SocialComments,WashComments,Washed")] CageLog cageLog) { if (id != cageLog.CageLogId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(cageLog); await _context.SaveChangesAsync(); sp_Logging("2-Change", "Edit", "User edited a Cage Log entry where ID= " + id.ToString(), "Success"); } catch (DbUpdateConcurrencyException) { if (!CageLogExists(cageLog.CageLogId)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["Animals"] = new SelectList(_context.Animal, "AnimalID", "Name", cageLog.AnimalID); return(View(cageLog)); }
public async Task <IActionResult> Create([Bind("CageLogId,AnimalID,Clean,Food,FoodComments,Social,SocialComments,WashComments,Washed")] CageLog cageLog) { if (ModelState.IsValid) { _context.Add(cageLog); await _context.SaveChangesAsync(); sp_Logging("2-Change", "Create", "User created a Cage Log entry where AnimalID=" + cageLog.AnimalID, "Success"); return(RedirectToAction("Index")); } ViewData["Animals"] = new SelectList(_context.Animal, "AnimalID", "Name", cageLog.AnimalID); return(View(cageLog)); }