- Timestamp:
- 08/29/24 20:27:21 (3 months ago)
- Branches:
- main
- Children:
- 99d0ecc
- Parents:
- a850333
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
PostgreSqlDotnetCore/Controllers/PetCaresController.cs
ra850333 re90ba32 57 57 { 58 58 // check for permission 59 bool isAuthenticated = User.Identity.IsAuthenticated; 59 60 UsersClass customerClass = await getCrrentUser(); 60 61 // set if is authenticated … … 75 76 76 77 var userPetCares = 77 await query. ToListAsync<Pet_CaresClass>();78 await query.Include(n => n.PetsClass).ToListAsync<Pet_CaresClass>(); 78 79 79 80 return View(userPetCares); … … 81 82 else 82 83 { 83 return View(db.PetCaresObj. ToList());84 return View(db.PetCaresObj.Include(n => n.PetsClass).ToList()); 84 85 } 85 86 … … 280 281 281 282 // POST: Customer/Delete/5 283 /* [HttpPost, ActionName("Delete")] 284 [ValidateAntiForgeryToken] 285 public ActionResult DeleteConfirmed(int id) 286 { 287 Pet_CaresClass peClass = db.PetCaresObj.Find(id); 288 db.PetCaresObj.Remove(peClass); 289 db.SaveChanges(); 290 return RedirectToAction("Index"); 291 } 292 */ 293 282 294 [HttpPost, ActionName("Delete")] 283 295 [ValidateAntiForgeryToken] 284 public ActionResult DeleteConfirmed(int id) 285 { 286 Pet_CaresClass peClass = db.PetCaresObj.Find(id); 296 public async Task<ActionResult> DeleteConfirmed(int id) 297 { 298 Pet_CaresClass peClass = await db.PetCaresObj.FindAsync(id); 299 if (peClass == null) 300 { 301 return RedirectToAction("NotExist", "Error"); 302 } 287 303 db.PetCaresObj.Remove(peClass); 288 db.SaveChanges();304 await db.SaveChangesAsync(); 289 305 return RedirectToAction("Index"); 290 306 }
Note:
See TracChangeset
for help on using the changeset viewer.