public String DeleteBoeken(List <int> BoekenToDelete, int vanaf, int desc, int filter) { if (!User.IsInRole("SuperAdministrator") && !User.IsInRole("Administrator")) { return("fail"); } foreach (int boek in BoekenToDelete) { Boek a = bs.GetBoekByIDAdmin(boek); if (a == null) { return("fail"); } bs.DeleteBoekSoft(a); } return("ok"); }
public ActionResult DeleteBoek(int?Id) { if (!Id.HasValue) { return(RedirectToAction("Index")); } Boek boek = bs.GetBoekByID((int)Id); if (boek == null) { return(RedirectToAction("Index")); } if (boek.EigenaarId != bs.GetUser(User.Identity.Name).Id) { return(RedirectToAction("Index")); } bs.DeleteBoekSoft(boek); return(RedirectToAction("Index")); }