public APIJsonResult Delete(int adminUserID) { var adminUserBLL = new TAdminUserBLL(); try { adminUserBLL.Delete(adminUserID); adminUserBLL.SaveChanges(); } catch (ValidationException ex) { return(Failed(ex.Message)); } var adminUserRoleBLL = new TAdminUserRoleBLL(); adminUserRoleBLL.Delete(ur => ur.AdminUserID == adminUserID); adminUserRoleBLL.SaveChanges(); return(Success()); }
public APIJsonResult MultiDelete(int[] adminUserIDs) { var adminUserBLL = new TAdminUserBLL(); var adminUserRoleIDs = adminUserBLL.Query(u => adminUserIDs.Contains(u.ID)).Select(u => u.TAdminUserRole.First().ID); try { adminUserBLL.Delete(adminUserIDs); adminUserBLL.SaveChanges(); } catch (ValidationException ex) { return(Failed(ex.Message)); } var adminUserRoleBLL = new TAdminUserRoleBLL(); adminUserRoleBLL.Delete(ur => adminUserRoleIDs.Contains(ur.ID)); adminUserRoleBLL.SaveChanges(); return(Success()); }